| 2820 | AUTODATA(json_command, &dev_sign_last_tx); |
| 2821 | |
| 2822 | static 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 | |
| 2855 | static const struct json_command dev_fail_command = { |
| 2856 | "dev-fail", |
nothing calls this directly
no test coverage detected