From 964156dc2dd0982060a36dbcb595ad27a9845f19 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 29 Sep 2019 14:00:50 +0200 Subject: [PATCH] db: Add transaction_annotations table --- wallet/db.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wallet/db.c b/wallet/db.c index 03cf06594..55cb55610 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -463,6 +463,18 @@ static struct migration dbmigrations[] = { {SQL("ALTER TABLE vars ADD COLUMN blobval BLOB"), NULL}, {SQL("UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')"), NULL}, {SQL("UPDATE vars SET blobval = CAST(val AS BLOB) WHERE name = 'genesis_hash'"), NULL}, + {SQL("CREATE TABLE transaction_annotations (" + /* Not making this a reference since we usually filter the TX by + * walking its inputs and outputs, and only afterwards storing it in + * the DB. Having a reference here would point into the void until we + * add the matching TX. */ + " txid BLOB" + ", idx INTEGER" /* 0 when location is the tx, the index of the output or input otherwise */ + ", location INTEGER" /* The transaction itself, the output at idx, or the input at idx */ + ", type INTEGER" + ", channel BIGINT REFERENCES channels(id)" + ", UNIQUE(txid, idx)" + ");"), NULL}, }; /* Leak tracking. */