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

Function waitblockheight_notify_new_block

lightningd/peer_control.c:3457–3477  ·  view source on GitHub ↗

Called by lightningd at each new block. */

Source from the content-addressed store, hash-verified

3455}
3456/* Called by lightningd at each new block. */
3457void waitblockheight_notify_new_block(struct lightningd *ld)
3458{
3459 u32 block_height = get_block_height(ld->topology);
3460 struct waitblockheight_waiter *w, *n;
3461 char *to_delete = tal(NULL, char);
3462
3463 /* Use safe since we could resolve commands and thus
3464 * trigger removal of list elements.
3465 */
3466 list_for_each_safe(&ld->waitblockheight_commands, w, n, list) {
3467 /* Skip commands that have not been reached yet. */
3468 if (w->block_height > block_height)
3469 continue;
3470
3471 list_del(&w->list);
3472 w->removed = true;
3473 tal_steal(to_delete, w);
3474 was_pending(waitblockheight_complete(w->cmd, block_height));
3475 }
3476 tal_free(to_delete);
3477}
3478static struct command_result *json_waitblockheight(struct command *cmd,
3479 const char *buffer,
3480 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