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

Function json_staticbackup

lightningd/peer_control.c:2976–3004  ·  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

2974/* This will return a SCB for all the channels currently loaded
2975 * in the in-memory channel */
2976static struct command_result *json_staticbackup(struct command *cmd,
2977 const char *buffer,
2978 const jsmntok_t *obj UNNEEDED,
2979 const jsmntok_t *params)
2980{
2981 struct json_stream *response;
2982 struct peer *peer;
2983 struct peer_node_id_map_iter it;
2984
2985 if (!param(cmd, buffer, params, NULL))
2986 return command_param_failed();
2987
2988 response = json_stream_success(cmd);
2989
2990 json_array_start(response, "scb");
2991 for (peer = peer_node_id_map_first(cmd->ld->peers, &it);
2992 peer;
2993 peer = peer_node_id_map_next(cmd->ld->peers, &it)) {
2994 struct channel *channel;
2995 list_for_each(&peer->channels, channel, list){
2996 if (channel_state_uncommitted(channel->state))
2997 continue;
2998 json_add_scb(cmd, NULL, response, channel);
2999 }
3000 }
3001 json_array_end(response);
3002
3003 return command_success(cmd, response);
3004}
3005
3006static const struct json_command staticbackup_command = {
3007 "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