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

Function txw_fire

lightningd/watch.c:202–235  ·  view source on GitHub ↗

Returns true if we fired a callback */

Source from the content-addressed store, hash-verified

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

Callers 2

txwatch_fireFunction · 0.85
watch_topology_changedFunction · 0.85

Calls 3

fmt_bitcoin_txidFunction · 0.85
tal_freeFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected