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

Function waitblockheight_notify_new_block

lightningd/peer_control.c:3665–3685  ·  view source on GitHub ↗

Called by lightningd at each new block. */

Source from the content-addressed store, hash-verified

3663}
3664/* Called by lightningd at each new block. */
3665void waitblockheight_notify_new_block(struct lightningd *ld)
3666{
3667 u32 block_height = get_block_height(ld->topology);
3668 struct waitblockheight_waiter *w, *n;
3669 char *to_delete = tal(NULL, char);
3670
3671 /* Use safe since we could resolve commands and thus
3672 * trigger removal of list elements.
3673 */
3674 list_for_each_safe(&ld->waitblockheight_commands, w, n, list) {
3675 /* Skip commands that have not been reached yet. */
3676 if (w->block_height > block_height)
3677 continue;
3678
3679 list_del(&w->list);
3680 w->removed = true;
3681 tal_steal(to_delete, w);
3682 was_pending(waitblockheight_complete(w->cmd, block_height));
3683 }
3684 tal_free(to_delete);
3685}
3686static struct command_result *json_waitblockheight(struct command *cmd,
3687 const char *buffer,
3688 const jsmntok_t *obj,

Callers 1

notify_new_blockFunction · 0.70

Calls 4

waitblockheight_completeFunction · 0.85
tal_freeFunction · 0.85
get_block_heightFunction · 0.70
was_pendingFunction · 0.70

Tested by

no test coverage detected