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

Function topo_update_spends

lightningd/chaintopology.c:662–686  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

660 * topo_update_spends -- Tell the wallet about all spent outpoints
661 */
662static void topo_update_spends(struct chain_topology *topo, struct block *b)
663{
664 const struct short_channel_id *spent_scids;
665 for (size_t i = 0; i < tal_count(b->full_txs); i++) {
666 const struct bitcoin_tx *tx = b->full_txs[i];
667
668 for (size_t j = 0; j < tx->wtx->num_inputs; j++) {
669 struct bitcoin_outpoint outpoint;
670
671 bitcoin_tx_input_get_outpoint(tx, j, &outpoint);
672
673 if (wallet_outpoint_spend(topo->ld->wallet, tmpctx,
674 b->height, &outpoint))
675 record_wallet_spend(topo->ld, &outpoint,
676 &b->txids[i], b->height);
677
678 }
679 }
680
681 /* Retrieve all potential channel closes from the UTXO set and
682 * tell gossipd about them. */
683 spent_scids =
684 wallet_utxoset_get_spent(tmpctx, topo->ld->wallet, b->height);
685 gossipd_notify_spends(topo->bitcoind->ld, b->height, spent_scids);
686}
687
688static void topo_add_utxos(struct chain_topology *topo, struct block *b)
689{

Callers 1

add_tipFunction · 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