Store hashes in hex form. It just makes things easier.

This commit is contained in:
JoelKatz
2011-12-02 16:23:31 -08:00
parent e575fea243
commit 150a3165c4

View File

@@ -1,32 +1,32 @@
CREATE TABLE Transactions ( -- transactions in all states CREATE TABLE Transactions ( -- transactions in all states
TransID BLOB PRIMARY KEY, TransID CHARACTER(64) PRIMARY KEY, -- in hex
FromID BLOB, -- 20 byte hash of pub key FromID CHARACTER(40), -- 20 byte hash of pub key in hex
FromSeq BIGINT UNSIGNED, -- account seq FromSeq BIGINT UNSIGNED, -- account seq
FromLedger BIGINT UNSIGNED, FromLedger BIGINT UNSIGNED,
ToID BLOB, -- 20 byte hash of pub key ToID CHARACTER(40), -- 20 byte hash of pub key
FirstSeen TEXT, -- time first seen FirstSeen TEXT, -- time first seen
CommitSeq BIGINT UNSIGNED, -- ledger commited to, 0 if none CommitSeq BIGINT UNSIGNED, -- ledger commited to, 0 if none
Status VARCHAR(1) -- (N)ew, (A)ctive, (C)onflicted, (D)one, (H)eld Status CHARACTER(1) -- (N)ew, (A)ctive, (C)onflicted, (D)one, (H)eld
); );
CREATE TABLE PubKeys ( -- holds pub keys for nodes and accounts CREATE TABLE PubKeys ( -- holds pub keys for nodes and accounts
ID BLOB PRIMARY KEY, ID CHARACTER(40) PRIMARY KEY,
PubKey BLOB NOT NULL PubKey CHARCTER(66) NOT NULL
); );
CREATE TABLE Ledgers ( -- closed ledgers CREATE TABLE Ledgers ( -- closed ledgers
LedgerHash BLOB PRIMARY KEY, LedgerHash CHARACTER(64) PRIMARY KEY,
LedgerSeq BIGINT UNSIGNED, LedgerSeq BIGINT UNSIGNED,
PrevHash BLOB, PrevHash CHARACTER(64),
FeeHeld BIGINT UNSIGNED, FeeHeld BIGINT UNSIGNED,
AccountSetHash BLOB, AccountSetHash CHARACTER(64),
TransSetHash BLOB, TransSetHash CHARACTER(64),
FullyStored VARCHAR(1), -- all data is in our db FullyStored CHARACTER(1), -- all data is in our db
Status VARCHAR(1) -- (A)ccepted, (C)ompatible, (I)ncompatible Status CHARACTER(1) -- (A)ccepted, (C)ompatible, (I)ncompatible
); );
CREATE INDEX SeqLedger ON Ledgers(LedgerSeq); CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);
@@ -35,8 +35,8 @@ CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);
CREATE TABLE LedgerConfirmations ( CREATE TABLE LedgerConfirmations (
LedgerSeq BIGINT UNSIGNED, LedgerSeq BIGINT UNSIGNED,
LedgerHash BLOB, LedgerHash CHARACTER(64),
Hanko BLOB, Hanko CHARACTER(40),
Signature BLOB Signature BLOB
); );
@@ -44,21 +44,21 @@ CREATE INDEX LedgerConfByHash ON LedgerConfirmations(LedgerHash);
CREATE TABLE TrustedNodes ( CREATE TABLE TrustedNodes (
Hanko BLOB PRIMARY KEY, Hanko CHARACTER(40) PRIMARY KEY,
TrustLevel SMALLINT, TrustLevel SMALLINT,
Comment TEXT Comment TEXT
); );
CREATE TABLE KnownNodes ( CREATE TABLE KnownNodes (
Hanko BLOB PRIMARY KEY, Hanko CHARACTER(40) PRIMARY KEY,
LastSeen TEXT, -- YYYY-MM-DD HH:MM:SS.SSS LastSeen TEXT, -- YYYY-MM-DD HH:MM:SS.SSS
HaveContactInfo VARCHAR(1), HaveContactInfo CHARACTER(1),
ContactObject BLOB ContactObject BLOB
); );
CREATE TABLE CommittedObjects ( -- used to synch nodes CREATE TABLE CommittedObjects ( -- used to synch nodes
Hash BLOB PRIMARY KEY, Hash CHARACTER(64) PRIMARY KEY,
ObjType CHAR(1) NOT NULL, -- (L)edger, (T)ransaction, (A)ccount node, transaction (N)ode ObjType CHAR(1) NOT NULL, -- (L)edger, (T)ransaction, (A)ccount node, transaction (N)ode
LedgerIndex BIGINT UNSIGNED, -- 0 if none LedgerIndex BIGINT UNSIGNED, -- 0 if none
Object BLOB Object BLOB
@@ -67,12 +67,11 @@ CREATE TABLE CommittedObjects ( -- used to synch nodes
CREATE INDEX ObjectLocate ON CommittedObjects(LedgerIndex, ObjType); CREATE INDEX ObjectLocate ON CommittedObjects(LedgerIndex, ObjType);
CREATE TABLE LocalAccounts ( -- wallet CREATE TABLE LocalAccounts ( -- wallet
ID BLOB PRIMARY KEY, ID CHARACTER(40) PRIMARY KEY,
Hash BLOB,
Seq BIGINT UNSIGNED, -- last transaction seen/issued Seq BIGINT UNSIGNED, -- last transaction seen/issued
Balance BIGINT UNSIGNED, Balance BIGINT UNSIGNED,
LedgerSeq BIGINT UNSIGNED, -- ledger this balance is from LedgerSeq BIGINT UNSIGNED, -- ledger this balance is from
KeyFormat TEXT, -- can be encrypted KeyFormat CHARACTER(1), -- can be encrypted
PrivateKey BLOB, PrivateKey BLOB,
Comment TEXT Comment TEXT
); );