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

Function refresh_moves_

plugins/bkpr/bookkeeper.c:286–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286static struct command_result *refresh_moves_(struct command *cmd,
287 struct command_result *(*cb)(
288 struct command *,
289 void *),
290 void *arg)
291{
292 struct out_req *req;
293 struct bkpr *bkpr = bkpr_of(cmd->plugin);
294 struct refresh_cb refresh_cb;
295
296 refresh_cb.cmd = cmd;
297 refresh_cb.cb = cb;
298 refresh_cb.arg = arg;
299
300 /* If rinfo already running, just jump on that.
301 *
302 * NOTE: We assume cmd will not exit before refresh, which is
303 * currently true, otherwise we'd need a destructor to remove it. */
304 if (bkpr->rinfo) {
305 tal_arr_expand(&bkpr->rinfo->callbacks, refresh_cb);
306 return command_still_pending(cmd);
307 }
308
309 bkpr->rinfo = tal(bkpr, struct refresh_info);
310 bkpr->rinfo->calls_remaining = 0;
311 bkpr->rinfo->callbacks = tal_dup_arr(bkpr->rinfo, struct refresh_cb, &refresh_cb, 1, 0);
312
313 req = jsonrpc_request_start(cmd, "listchainmoves",
314 listchainmoves_done,
315 plugin_broken_cb,
316 use_rinfo(bkpr->rinfo));
317 json_add_string(req->js, "index", "created");
318 json_add_u64(req->js, "start", bkpr->chainmoves_index + 1);
319 return send_outreq(req);
320}
321
322#define refresh_moves(cmd, cb, arg) \
323 refresh_moves_((cmd), \

Callers

nothing calls this directly

Calls 6

use_rinfoFunction · 0.85
json_add_u64Function · 0.85
bkpr_ofFunction · 0.70
command_still_pendingFunction · 0.50
json_add_stringFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected