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

Function listchannelmoves_done

plugins/bkpr/bookkeeper.c:214–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213#define LISTCHANNELMOVES_LIMIT 10000
214static struct command_result *listchannelmoves_done(struct command *cmd,
215 const char *method,
216 const char *buf,
217 const jsmntok_t *result,
218 struct refresh_info *rinfo)
219{
220 const jsmntok_t *moves, *t;
221 size_t i;
222 struct bkpr *bkpr = bkpr_of(cmd->plugin);
223 be64 be_index;
224
225 moves = json_get_member(buf, result, "channelmoves");
226 json_for_each_arr(i, t, moves)
227 parse_and_log_channel_move(cmd, buf, t, rinfo);
228
229 be_index = cpu_to_be64(bkpr->channelmoves_index);
230 jsonrpc_set_datastore_binary(cmd,
231 mkdatastorekey(tmpctx, "bookkeeper", "channelmoves_index"),
232 &be_index, sizeof(be_index),
233 "create-or-replace",
234 datastore_done, NULL, use_rinfo(rinfo));
235
236 /* If there might be more, try asking for more */
237 if (moves->size == LISTCHANNELMOVES_LIMIT)
238 limited_listchannelmoves(cmd, rinfo);
239
240 return rinfo_one_done(cmd, rinfo);
241}
242
243/* We do 1000 at a time to avoid overwhelming lightningd */
244static struct command_result *limited_listchannelmoves(struct command *cmd,

Callers

nothing calls this directly

Calls 7

json_get_memberFunction · 0.85
cpu_to_be64Function · 0.85
use_rinfoFunction · 0.85
limited_listchannelmovesFunction · 0.85
rinfo_one_doneFunction · 0.85
bkpr_ofFunction · 0.70

Tested by

no test coverage detected