From 771ff1f21485aef994330c3bc33c67d7b0a68bf8 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 23 May 2019 23:01:00 +0200 Subject: [PATCH] chaintopology: Annotate transactions as deposits if we owned outputs Signed-off-by: Christian Decker --- lightningd/chaintopology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 7db454bc9..37f75fb34 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -85,16 +85,18 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b) } owned = AMOUNT_SAT(0); + bitcoin_txid(tx, &txid); if (txfilter_match(topo->bitcoind->ld->owned_txfilter, tx)) { wallet_extract_owned_outputs(topo->bitcoind->ld->wallet, - tx, &b->height, - &owned); + tx, &b->height, &owned); + wallet_transaction_add(topo->ld->wallet, tx, b->height, + i); + wallet_transaction_annotate(topo->ld->wallet, &txid, + TX_WALLET_DEPOSIT, 0); } /* 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) || - !amount_sat_eq(owned, AMOUNT_SAT(0))) { + if (watching_txid(topo, &txid) || we_broadcast(topo, &txid)) { wallet_transaction_add(topo->ld->wallet, tx, b->height, i); }