mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
db: Add confirmation_height and spend_height columns to outputs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
1aa21498c3
commit
7f00230657
@ -206,6 +206,15 @@ char *dbmigrations[] = {
|
|||||||
* primarily to track confirmations across restarts and making
|
* primarily to track confirmations across restarts and making
|
||||||
* sure we handle reorgs correctly. */
|
* sure we handle reorgs correctly. */
|
||||||
"CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));",
|
"CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));",
|
||||||
|
/* ON DELETE CASCADE would have been nice for confirmation_height,
|
||||||
|
* so that we automatically delete outputs that fall off the
|
||||||
|
* blockchain and then we rediscover them if they are included
|
||||||
|
* again. However, we have the their_unilateral/to_us which we
|
||||||
|
* can't simply recognize from the chain without additional
|
||||||
|
* hints. So we just mark them as unconfirmed should the block
|
||||||
|
* die. */
|
||||||
|
"ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;",
|
||||||
|
"ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user