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

Function json_staticbackup

lightningd/peer_control.c:2702–2730  ·  view source on GitHub ↗

This will return a SCB for all the channels currently loaded * in the in-memory channel */

Source from the content-addressed store, hash-verified

2700/* This will return a SCB for all the channels currently loaded
2701 * in the in-memory channel */
2702static struct command_result *json_staticbackup(struct command *cmd,
2703 const char *buffer,
2704 const jsmntok_t *obj UNNEEDED,
2705 const jsmntok_t *params)
2706{
2707 struct json_stream *response;
2708 struct peer *peer;
2709 struct peer_node_id_map_iter it;
2710
2711 if (!param(cmd, buffer, params, NULL))
2712 return command_param_failed();
2713
2714 response = json_stream_success(cmd);
2715
2716 json_array_start(response, "scb");
2717 for (peer = peer_node_id_map_first(cmd->ld->peers, &it);
2718 peer;
2719 peer = peer_node_id_map_next(cmd->ld->peers, &it)) {
2720 struct channel *channel;
2721 list_for_each(&peer->channels, channel, list){
2722 if (channel_state_uncommitted(channel->state))
2723 continue;
2724 json_add_scb(cmd, NULL, response, channel);
2725 }
2726 }
2727 json_array_end(response);
2728
2729 return command_success(cmd, response);
2730}
2731
2732static const struct json_command staticbackup_command = {
2733 "staticbackup",

Callers

nothing calls this directly

Calls 8

json_array_startFunction · 0.85
json_add_scbFunction · 0.85
json_array_endFunction · 0.85
command_param_failedFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected