wallet: Move tx annotation for deposits into the wallet

We have split the iteration over the txs and the output in different
functions, so pushing the annotation down, while keeping the transaction
addition atop. This showcases the need to not have the txid reference the
transactions.id in the DB: we annotate in a function that doesn't have the tx
index context, but only add the TX after we have finished extracting.
This commit is contained in:
Christian Decker 2019-09-30 22:25:00 +02:00 committed by neil saitug
parent 3d14c18074
commit ddae604f3d
2 changed files with 2 additions and 2 deletions

View File

@ -92,8 +92,6 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b)
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. */

View File

@ -1577,6 +1577,8 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct bitcoin_tx *tx,
type_to_string(tmpctx, struct amount_sat, total),
type_to_string(tmpctx, struct amount_sat,
&utxo->amount));
wallet_annotate_txout(w, &utxo->txid, output, TX_WALLET_DEPOSIT, 0);
tal_free(utxo);
num_utxos++;
}