mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
db: Add channel_id and type to the transactions table
Mainly used to differentiate channel-related transactions from on-chain wallet transactions. Will be used to filter `listtransaction` results and bundle transactions that belong to the same channel. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
9e98d01d02
commit
1e2291c40c
@ -385,6 +385,13 @@ static struct migration dbmigrations[] = {
|
|||||||
/* remote signatures for channel announcement */
|
/* remote signatures for channel announcement */
|
||||||
{ "ALTER TABLE channels ADD remote_ann_node_sig BLOB;", NULL },
|
{ "ALTER TABLE channels ADD remote_ann_node_sig BLOB;", NULL },
|
||||||
{ "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;", NULL },
|
{ "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;", NULL },
|
||||||
|
/* Additional information for transaction tracking and listing */
|
||||||
|
{ "ALTER TABLE transactions ADD type INTEGER;", NULL },
|
||||||
|
/* Not a foreign key on purpose since we still delete channels from
|
||||||
|
* the DB which would remove this. It is mainly used to group payments
|
||||||
|
* in the list view anyway, e.g., show all close and htlc transactions
|
||||||
|
* as a single bundle. */
|
||||||
|
{ "ALTER TABLE transactions ADD channel_id INTEGER;", NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Leak tracking. */
|
/* Leak tracking. */
|
||||||
|
@ -2528,7 +2528,7 @@ struct channeltx *wallet_channeltxs_get(struct wallet *w, const tal_t *ctx,
|
|||||||
", t.id as txid "
|
", t.id as txid "
|
||||||
"FROM channeltxs c "
|
"FROM channeltxs c "
|
||||||
"JOIN transactions t ON t.id == c.transaction_id "
|
"JOIN transactions t ON t.id == c.transaction_id "
|
||||||
"WHERE channel_id = ? "
|
"WHERE c.channel_id = ? "
|
||||||
"ORDER BY c.id ASC;");
|
"ORDER BY c.id ASC;");
|
||||||
sqlite3_bind_int(stmt, 1, channel_id);
|
sqlite3_bind_int(stmt, 1, channel_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user