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

Function json_dev_reenable_commit

lightningd/peer_control.c:2871–2912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2869}
2870
2871static struct command_result *json_dev_reenable_commit(struct command *cmd,
2872 const char *buffer,
2873 const jsmntok_t *obj UNNEEDED,
2874 const jsmntok_t *params)
2875{
2876 struct node_id *peerid;
2877 struct peer *peer;
2878 u8 *msg;
2879 struct channel *channel;
2880 bool more_than_one;
2881
2882 if (!param(cmd, buffer, params,
2883 p_req("id", param_node_id, &peerid),
2884 NULL))
2885 return command_param_failed();
2886
2887 peer = peer_by_id(cmd->ld, peerid);
2888 if (!peer) {
2889 return command_fail(cmd, LIGHTNINGD,
2890 "Could not find peer with that id");
2891 }
2892
2893 channel = peer_any_active_channel(peer, &more_than_one);
2894 if (!channel || more_than_one) {
2895 return command_fail(cmd, LIGHTNINGD,
2896 "Peer has no active channel");
2897 }
2898 if (!channel->owner) {
2899 return command_fail(cmd, LIGHTNINGD,
2900 "Peer has no owner");
2901 }
2902
2903 if (!streq(channel->owner->name, "channeld")) {
2904 return command_fail(cmd, LIGHTNINGD,
2905 "Peer owned by %s", channel->owner->name);
2906 }
2907
2908 msg = towire_channeld_dev_reenable_commit(channel);
2909 subd_req(peer, channel->owner, take(msg), -1, 0,
2910 dev_reenable_commit_finished, cmd);
2911 return command_still_pending(cmd);
2912}
2913
2914static const struct json_command dev_reenable_commit = {
2915 "dev-reenable-commit",

Callers

nothing calls this directly

Calls 8

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