* topo_update_spends -- Tell the wallet about all spent outpoints */
| 934 | * topo_update_spends -- Tell the wallet about all spent outpoints |
| 935 | */ |
| 936 | static 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 | |
| 966 | static void topo_add_utxos(struct chain_topology *topo, struct block *b) |
| 967 | { |
no test coverage detected