MCPcopy Create free account
hub / github.com/ElementsProject/lightning / topo_update_spends

Function topo_update_spends

lightningd/chaintopology.c:936–964  ·  view source on GitHub ↗

* topo_update_spends -- Tell the wallet about all spent outpoints */

Source from the content-addressed store, hash-verified

934 * topo_update_spends -- Tell the wallet about all spent outpoints
935 */
936static void topo_update_spends(struct chain_topology *topo,
937 struct bitcoin_tx **txs,
938 const struct bitcoin_txid *txids,
939 u32 blockheight)
940{
941 const struct short_channel_id *spent_scids;
942 const size_t num_txs = tal_count(txs);
943 for (size_t i = 0; i < num_txs; i++) {
944 const struct bitcoin_tx *tx = txs[i];
945
946 for (size_t j = 0; j < tx->wtx->num_inputs; j++) {
947 struct bitcoin_outpoint outpoint;
948
949 bitcoin_tx_input_get_outpoint(tx, j, &outpoint);
950
951 if (wallet_outpoint_spend(tmpctx, topo->ld->wallet,
952 blockheight, &outpoint))
953 record_wallet_spend(topo->ld, &outpoint,
954 &txids[i], blockheight);
955
956 }
957 }
958
959 /* Retrieve all potential channel closes from the UTXO set and
960 * tell gossipd about them. */
961 spent_scids =
962 wallet_utxoset_get_spent(tmpctx, topo->ld->wallet, blockheight);
963 gossipd_notify_spends(topo->bitcoind->ld, blockheight, spent_scids);
964}
965
966static void topo_add_utxos(struct chain_topology *topo, struct block *b)
967{

Callers 2

add_tipFunction · 0.85
fixup_scan_blockFunction · 0.85

Calls 5

wallet_outpoint_spendFunction · 0.85
record_wallet_spendFunction · 0.85
wallet_utxoset_get_spentFunction · 0.85
gossipd_notify_spendsFunction · 0.85

Tested by

no test coverage detected