From 50600ae24101ea815fa7fea2f5a5a5cd18ad4ba6 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 9 Apr 2018 14:37:21 +0200 Subject: [PATCH] wallet: Store transactions we are watching, broadcast or own This will later allow us to determine the transaction confirmation count, and recover transactions for rebroadcasts. Signed-off-by: Christian Decker --- lightningd/chaintopology.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 5388fdb8c..3b253f9cf 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -85,8 +85,10 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b) /* We did spends first, in case that tells us to watch tx. */ bitcoin_txid(tx, &txid); if (watching_txid(topo, &txid) || we_broadcast(topo, &txid) || - satoshi_owned != 0) + satoshi_owned != 0) { add_tx_to_block(b, tx, i); + wallet_transaction_add(topo->wallet, tx, b->height, i); + } } b->full_txs = tal_free(b->full_txs); } @@ -257,6 +259,7 @@ void broadcast_tx(struct chain_topology *topo, log_add(topo->log, " (tx %s)", type_to_string(tmpctx, struct bitcoin_txid, &otx->txid)); + wallet_transaction_add(topo->wallet, tx, 0, 0); bitcoind_sendrawtx(topo->bitcoind, otx->hextx, broadcast_done, otx); }