-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
identities: refactor is_malicious check to read minimal amount of data
- Loading branch information
Showing
8 changed files
with
85 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
sql/statesql/schema/migrations/0024_identities_speedup.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ALTER TABLE identities RENAME TO identities_old; | ||
CREATE TABLE identities | ||
( | ||
pubkey VARCHAR PRIMARY KEY, | ||
is_malicious BOOLEAN DEFAULT FALSE NOT NULL, | ||
proof BLOB, | ||
marriage_atx CHAR(32), | ||
received INT DEFAULT 0 NOT NULL, | ||
marriage_atx CHAR(32), | ||
marriage_idx INTEGER, | ||
marriage_target CHAR(32), | ||
marriage_signature CHAR(64) | ||
); | ||
|
||
INSERT INTO identities (pubkey, is_malicious, proof, received, marriage_atx, marriage_idx, marriage_target, marriage_signature) | ||
SELECT pubkey, proof IS NOT NULL, proof, received, marriage_atx, marriage_idx, marriage_target, marriage_signature FROM identities_old; | ||
|
||
DROP TABLE identities_old; | ||
|
||
CREATE INDEX malicious_identities ON identities (pubkey) where is_malicious; | ||
CREATE INDEX malicious_marriages ON identities (marriage_atx) where is_malicious; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters