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

Function bwatch_start_rescan

plugins/bwatch/bwatch.c:404–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404void bwatch_start_rescan(struct command *cmd,
405 const struct watch *w,
406 u32 start_block,
407 u32 target_block)
408{
409 struct rescan_state *rescan;
410
411 if (w) {
412 plugin_log(cmd->plugin, LOG_INFORM,
413 "Starting rescan for %s watch: blocks %u-%u",
414 bwatch_get_watch_type_name(w->type),
415 start_block, target_block);
416 } else {
417 plugin_log(cmd->plugin, LOG_INFORM,
418 "Starting rescan for all watches: blocks %u-%u",
419 start_block, target_block);
420 }
421
422 /* Owned by `cmd` so it lives across the async chain and gets
423 * freed automatically when the command completes. */
424 rescan = tal(cmd, struct rescan_state);
425 rescan->watch = w;
426 rescan->current_block = start_block;
427 rescan->target_block = target_block;
428
429 /* Fire the first getrawblockbyheight; each response runs
430 * rescan_block_done, which fetches the next block until we
431 * pass target_block. */
432 fetch_block_rescan(cmd, rescan->current_block,
433 rescan_block_done, rescan);
434}
435
436static const char *init(struct command *cmd,
437 const char *buf UNUSED,

Callers 1

Calls 3

fetch_block_rescanFunction · 0.85
plugin_logFunction · 0.50

Tested by

no test coverage detected