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

Function json_dev_fail

lightningd/peer_control.c:2822–2853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2820AUTODATA(json_command, &dev_sign_last_tx);
2821
2822static struct command_result *json_dev_fail(struct command *cmd,
2823 const char *buffer,
2824 const jsmntok_t *obj UNNEEDED,
2825 const jsmntok_t *params)
2826{
2827 struct node_id *peerid;
2828 struct peer *peer;
2829 struct channel *channel;
2830 bool more_than_one;
2831
2832 if (!param(cmd, buffer, params,
2833 p_req("id", param_node_id, &peerid),
2834 NULL))
2835 return command_param_failed();
2836
2837 peer = peer_by_id(cmd->ld, peerid);
2838 if (!peer) {
2839 return command_fail(cmd, LIGHTNINGD,
2840 "Could not find peer with that id");
2841 }
2842
2843 channel = peer_any_active_channel(peer, &more_than_one);
2844 if (!channel || more_than_one) {
2845 return command_fail(cmd, LIGHTNINGD,
2846 "Could not find single active channel with peer");
2847 }
2848
2849 channel_fail_permanent(channel,
2850 REASON_USER,
2851 "Failing due to dev-fail command");
2852 return command_success(cmd, json_stream_success(cmd));
2853}
2854
2855static const struct json_command dev_fail_command = {
2856 "dev-fail",

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
channel_fail_permanentFunction · 0.70
command_successFunction · 0.70
json_stream_successFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected