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