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

Function watch_tx_and_outputs

lightningd/onchain_control.c:241–257  ·  view source on GitHub ↗

To avoid races, we watch the tx and all outputs. */

Source from the content-addressed store, hash-verified

239
240/* To avoid races, we watch the tx and all outputs. */
241static void watch_tx_and_outputs(struct channel *channel,
242 const struct bitcoin_tx *tx)
243{
244 struct bitcoin_outpoint outpoint;
245 struct txwatch *txw;
246 struct lightningd *ld = channel->peer->ld;
247
248 bitcoin_txid(tx, &outpoint.txid);
249
250 /* Make txwatch a parent of txo watches, so we can unwatch together. */
251 txw = watch_tx(channel->owner, ld->topology, channel, tx,
252 onchain_tx_watched);
253
254 for (outpoint.n = 0; outpoint.n < tx->wtx->num_outputs; outpoint.n++)
255 watch_txo(txw, ld->topology, channel, &outpoint,
256 onchain_txo_watched);
257}
258
259static void handle_onchain_log_coin_move(struct channel *channel, const u8 *msg)
260{

Callers 2

onchain_txo_spentFunction · 0.85
onchaind_funding_spentFunction · 0.85

Calls 3

watch_txFunction · 0.85
bitcoin_txidClass · 0.70
watch_txoFunction · 0.70

Tested by

no test coverage detected