Watchman acked block_processed: safe to poll for the next block. */
| 116 | |
| 117 | /* Watchman acked block_processed: safe to poll for the next block. */ |
| 118 | static 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. */ |
nothing calls this directly
no test coverage detected