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

Function json_dev_quiesce

lightningd/channel_control.c:1177–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1175}
1176
1177static 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
1210static const struct json_command dev_quiesce_command = {
1211 "dev-quiesce",

Callers

nothing calls this directly

Calls 7

peer_by_idFunction · 0.85
command_param_failedFunction · 0.70
command_failFunction · 0.70
peer_any_active_channelFunction · 0.70
subd_reqClass · 0.70
command_still_pendingFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected