Browse Source

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.
travis-debug
Christian Decker 5 years ago
committed by neil saitug
parent
commit
ddae604f3d
  1. 2
      lightningd/chaintopology.c
  2. 2
      wallet/wallet.c

2
lightningd/chaintopology.c

@ -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. */

2
wallet/wallet.c

@ -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++;
}

Loading…
Cancel
Save