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

Function txw_fire

lightningd/watch.c:211–242  ·  view source on GitHub ↗

Returns true if we fired a callback */

Source from the content-addressed store, hash-verified

209
210/* Returns true if we fired a callback */
211static bool txw_fire(struct txwatch *txw,
212 const struct bitcoin_txid *txid,
213 unsigned int depth)
214{
215 enum watch_result r;
216 struct log *log;
217
218 if (depth == txw->depth)
219 return false;
220 if (txw->channel)
221 log = txw->channel->log;
222 else
223 log = txw->topo->log;
224
225 /* We assume zero depth signals a reorganization */
226 log_debug(log,
227 "Got depth change %u->%u for %s%s",
228 txw->depth, depth,
229 type_to_string(tmpctx, struct bitcoin_txid, &txw->txid),
230 depth ? "" : " REORG");
231 txw->depth = depth;
232 r = txw->cb(txw->topo->bitcoind->ld, txw->channel, txid, txw->tx,
233 txw->depth);
234 switch (r) {
235 case DELETE_WATCH:
236 tal_free(txw);
237 return true;
238 case KEEP_WATCHING:
239 return true;
240 }
241 fatal("txwatch callback %p returned %i\n", txw->cb, r);
242}
243
244void txwatch_fire(struct chain_topology *topo,
245 const struct bitcoin_txid *txid,

Callers 2

txwatch_fireFunction · 0.85
watch_topology_changedFunction · 0.85

Calls 3

tal_freeFunction · 0.85
fatalFunction · 0.70
type_to_stringClass · 0.50

Tested by

no test coverage detected