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

Function waitblockheight_notify_new_block

lightningd/peer_control.c:2379–2400  ·  view source on GitHub ↗

Called by lightningd at each new block. */

Source from the content-addressed store, hash-verified

2377}
2378/* Called by lightningd at each new block. */
2379void waitblockheight_notify_new_block(struct lightningd *ld,
2380 u32 block_height)
2381{
2382 struct waitblockheight_waiter *w, *n;
2383 char *to_delete = tal(NULL, char);
2384
2385 /* Use safe since we could resolve commands and thus
2386 * trigger removal of list elements.
2387 */
2388 list_for_each_safe(&ld->waitblockheight_commands, w, n, list) {
2389 /* Skip commands that have not been reached yet. */
2390 if (w->block_height > block_height)
2391 continue;
2392
2393 list_del(&w->list);
2394 w->removed = true;
2395 tal_steal(to_delete, w);
2396 was_pending(waitblockheight_complete(w->cmd,
2397 block_height));
2398 }
2399 tal_free(to_delete);
2400}
2401static struct command_result *json_waitblockheight(struct command *cmd,
2402 const char *buffer,
2403 const jsmntok_t *obj,

Callers 1

notify_new_blockFunction · 0.70

Calls 3

was_pendingFunction · 0.85
waitblockheight_completeFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected