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

Function json_dev_quiesce

lightningd/channel_control.c:2899–2935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2897}
2898
2899static struct command_result *json_dev_quiesce(struct command *cmd,
2900 const char *buffer,
2901 const jsmntok_t *obj UNNEEDED,
2902 const jsmntok_t *params)
2903{
2904 struct node_id *id;
2905 struct peer *peer;
2906 struct channel *channel;
2907 const u8 *msg;
2908 bool more_than_one;
2909
2910 if (!param_check(cmd, buffer, params,
2911 p_req("id", param_node_id, &id),
2912 NULL))
2913 return command_param_failed();
2914
2915 peer = peer_by_id(cmd->ld, id);
2916 if (!peer)
2917 return command_fail(cmd, LIGHTNINGD, "Peer not connected");
2918
2919 /* FIXME: If this becomes a real API, check for OPT_QUIESCE! */
2920 channel = peer_any_channel_bystate(peer, channel_state_wants_peercomms,
2921 &more_than_one);
2922 if (!channel || !channel->owner)
2923 return command_fail(cmd, LIGHTNINGD, "Peer bad state");
2924 /* This is a dev command: fix the api if you need this! */
2925 if (more_than_one)
2926 return command_fail(cmd, LIGHTNINGD, "More than one channel");
2927
2928 if (command_check_only(cmd))
2929 return command_check_done(cmd);
2930
2931 msg = towire_channeld_dev_quiesce(NULL);
2932 subd_req(channel->owner, channel->owner, take(msg), -1, 0,
2933 quiesce_reply, cmd);
2934 return command_still_pending(cmd);
2935}
2936
2937static const struct json_command dev_quiesce_command = {
2938 "dev-quiesce",

Callers

nothing calls this directly

Calls 9

param_checkFunction · 0.85
peer_by_idFunction · 0.85
command_param_failedFunction · 0.70
command_failFunction · 0.70
peer_any_channel_bystateFunction · 0.70
command_check_onlyFunction · 0.70
command_check_doneFunction · 0.70
subd_reqClass · 0.70
command_still_pendingFunction · 0.70

Tested by

no test coverage detected