| 1175 | } |
| 1176 | |
| 1177 | static struct command_result *json_dev_quiesce(struct command *cmd, |
| 1178 | const char *buffer, |
| 1179 | const jsmntok_t *obj UNNEEDED, |
| 1180 | const jsmntok_t *params) |
| 1181 | { |
| 1182 | struct node_id *id; |
| 1183 | struct peer *peer; |
| 1184 | struct channel *channel; |
| 1185 | const u8 *msg; |
| 1186 | bool more_than_one; |
| 1187 | |
| 1188 | if (!param(cmd, buffer, params, |
| 1189 | p_req("id", param_node_id, &id), |
| 1190 | NULL)) |
| 1191 | return command_param_failed(); |
| 1192 | |
| 1193 | peer = peer_by_id(cmd->ld, id); |
| 1194 | if (!peer) |
| 1195 | return command_fail(cmd, LIGHTNINGD, "Peer not connected"); |
| 1196 | |
| 1197 | channel = peer_any_active_channel(peer, &more_than_one); |
| 1198 | if (!channel || !channel->owner || channel->state != CHANNELD_NORMAL) |
| 1199 | return command_fail(cmd, LIGHTNINGD, "Peer bad state"); |
| 1200 | /* This is a dev command: fix the api if you need this! */ |
| 1201 | if (more_than_one) |
| 1202 | return command_fail(cmd, LIGHTNINGD, "More than one channel"); |
| 1203 | |
| 1204 | msg = towire_channeld_dev_quiesce(NULL); |
| 1205 | subd_req(channel->owner, channel->owner, take(msg), -1, 0, |
| 1206 | quiesce_reply, cmd); |
| 1207 | return command_still_pending(cmd); |
| 1208 | } |
| 1209 | |
| 1210 | static const struct json_command dev_quiesce_command = { |
| 1211 | "dev-quiesce", |
nothing calls this directly
no test coverage detected