This will return a SCB for all the channels currently loaded * in the in-memory channel */
| 2974 | /* This will return a SCB for all the channels currently loaded |
| 2975 | * in the in-memory channel */ |
| 2976 | static 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 | |
| 3006 | static const struct json_command staticbackup_command = { |
| 3007 | "staticbackup", |
nothing calls this directly
no test coverage detected