db: Add utxoset table

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-03-03 22:25:05 +01:00
parent 5a1b4b91e2
commit ec014be2a8

View File

@@ -217,6 +217,16 @@ char *dbmigrations[] = {
"ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;",
/* Create a covering index that covers both fields */
"CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);",
"CREATE TABLE utxoset ("
" txid BLOB,"
" outnum INT,"
" blockheight INT REFERENCES blocks(height) ON DELETE CASCADE,"
" spendheight INT REFERENCES blocks(height) ON DELETE SET NULL,"
" txindex INT,"
" scriptpubkey BLOB,"
" satoshis BIGINT,"
" PRIMARY KEY(txid, outnum));",
"CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)",
NULL,
};