Skip to content

Commit

Permalink
lightningd: don't allow old listforwards arg order.
Browse files Browse the repository at this point in the history
Changelog-Removed: Old order of the `status` parameter in the `listforwards` rpc command (deprecated in v0.10.2)
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Sep 12, 2022
1 parent 43b037a commit a45ec78
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2853,30 +2853,13 @@ static struct command_result *json_listforwards(struct command *cmd,
const char *status_str;
enum forward_status status = FORWARD_ANY;

// TODO: We will remove soon after the deprecated period.
if (params && deprecated_apis && params->type == JSMN_ARRAY) {
struct short_channel_id scid;
/* We need to catch [ null, null, "settled" ], and
* [ "1x2x3" ] as old-style */
if ((params->size > 0 && json_to_short_channel_id(buffer, params + 1, &scid)) ||
(params->size == 3 && !json_to_short_channel_id(buffer, params + 3, &scid))) {
if (!param(cmd, buffer, params,
p_opt("in_channel", param_short_channel_id, &chan_in),
p_opt("out_channel", param_short_channel_id, &chan_out),
p_opt("status", param_string, &status_str),
NULL))
return command_param_failed();
goto parsed;
}
}

if (!param(cmd, buffer, params,
p_opt("status", param_string, &status_str),
p_opt("in_channel", param_short_channel_id, &chan_in),
p_opt("out_channel", param_short_channel_id, &chan_out),
NULL))
return command_param_failed();
parsed:

if (status_str && !string_to_forward_status(status_str, &status))
return command_fail(cmd, JSONRPC2_INVALID_PARAMS, "Unrecognized status: %s", status_str);

Expand Down

0 comments on commit a45ec78

Please sign in to comment.