From 26aa0e2aa42da8670e2f28986e5ccdcc837e14ab Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 25 Nov 2017 13:31:20 +0100 Subject: [PATCH] topogoly: Extract owned funds from transactions in blocks Signed-off-by: Christian Decker --- lightningd/chaintopology.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 76e6c1a35..353a2a291 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -58,6 +58,7 @@ static void connect_block(struct chain_topology *topo, struct block *b) { size_t i; + u64 satoshi_owned; assert(b->height == -1); assert(b->prev == NULL); @@ -86,9 +87,14 @@ static void connect_block(struct chain_topology *topo, txowatch_fire(topo, txo, tx, j, b); } + satoshi_owned = 0; + wallet_extract_owned_outputs(topo->bitcoind->ld->wallet, tx, + &satoshi_owned); + /* 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)) + if (watching_txid(topo, &txid) || we_broadcast(topo, &txid) || + satoshi_owned != 0) add_tx_to_block(b, tx, i); } b->full_txs = tal_free(b->full_txs);