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

Function watch_blockdepth_

lightningd/watch.c:557–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555}
556
557bool watch_blockdepth_(const tal_t *ctx,
558 struct chain_topology *topo,
559 u32 blockheight,
560 enum watch_result (*depthcb)(struct lightningd *ld, u32 depth, void *),
561 enum watch_result (*reorgcb)(struct lightningd *ld, void *),
562 void *arg)
563{
564 struct blockdepthwatch *w;
565
566 if (find_blockdepthwatch(topo->blockdepthwatches, blockheight, depthcb, reorgcb, arg))
567 return false;
568
569 w = tal(ctx, struct blockdepthwatch);
570 w->height = blockheight;
571 w->depthcb = depthcb;
572 w->reorgcb = reorgcb;
573 w->arg = arg;
574 blockdepthwatch_hash_add(topo->blockdepthwatches, w);
575 tal_add_destructor2(w, destroy_blockdepthwatch, topo);
576 return true;
577}
578
579void watch_check_block_added(const struct chain_topology *topo, u32 blockheight)
580{

Callers

nothing calls this directly

Calls 1

find_blockdepthwatchFunction · 0.85

Tested by

no test coverage detected