* Notify onchaind that an output was spent and register new watches. */
| 199 | * Notify onchaind that an output was spent and register new watches. |
| 200 | */ |
| 201 | static void onchain_txo_spent(struct channel *channel, const struct bitcoin_tx *tx, size_t input_num, u32 blockheight) |
| 202 | { |
| 203 | u8 *msg; |
| 204 | /* Onchaind needs all inputs, since it uses those to compare |
| 205 | * with existing spends (which can vary, with feerate changes). */ |
| 206 | struct tx_parts *parts = tx_parts_from_wally_tx(tmpctx, tx->wtx, |
| 207 | -1, -1); |
| 208 | |
| 209 | watch_tx_and_outputs(channel, tx); |
| 210 | |
| 211 | msg = towire_onchaind_spent(channel, parts, input_num, blockheight); |
| 212 | subd_send_msg(channel->owner, take(msg)); |
| 213 | |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Entrypoint for the txowatch callback, stores tx and calls onchain_txo_spent. |
no test coverage detected