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

Function block_processed_ack

plugins/bwatch/bwatch_interface.c:118–142  ·  view source on GitHub ↗

Watchman acked block_processed: safe to poll for the next block. */

Source from the content-addressed store, hash-verified

116
117/* Watchman acked block_processed: safe to poll for the next block. */
118static struct command_result *block_processed_ack(struct command *cmd,
119 const char *method UNUSED,
120 const char *buf,
121 const jsmntok_t *result,
122 void *unused UNUSED)
123{
124 struct bwatch *bwatch = bwatch_of(cmd->plugin);
125 u32 acked_height;
126 const char *err;
127
128 err = json_scan(tmpctx, buf, result,
129 "{blockheight:%}",
130 JSON_SCAN(json_to_number, &acked_height));
131 if (err)
132 plugin_err(cmd->plugin, "block_processed ack '%.*s': %s",
133 json_tok_full_len(result),
134 json_tok_full(buf, result), err);
135
136 plugin_log(cmd->plugin, LOG_DBG,
137 "Received block_processed ack for height %u", acked_height);
138
139 bwatch->poll_timer = global_timer(cmd->plugin, time_from_sec(0),
140 bwatch_poll_chain, NULL);
141 return timer_complete(cmd);
142}
143
144/* Non-fatal: watchman may not be ready yet (e.g. lightningd still booting).
145 * Reschedule the poll anyway so we keep retrying without busy-looping. */

Callers

nothing calls this directly

Calls 8

bwatch_ofFunction · 0.85
time_from_secFunction · 0.85
timer_completeFunction · 0.85
json_scanFunction · 0.50
plugin_errFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
plugin_logFunction · 0.50

Tested by

no test coverage detected