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

Function onchain_txo_spent

lightningd/onchain_control.c:201–214  ·  view source on GitHub ↗

* Notify onchaind that an output was spent and register new watches. */

Source from the content-addressed store, hash-verified

199 * Notify onchaind that an output was spent and register new watches.
200 */
201static 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.

Callers 2

onchain_txo_watchedFunction · 0.85
onchaind_replay_channelsFunction · 0.85

Calls 3

tx_parts_from_wally_txFunction · 0.85
watch_tx_and_outputsFunction · 0.85
subd_send_msgFunction · 0.70

Tested by

no test coverage detected