common: remove no-longer-required p_req_dup_ok hack.

This was for "msatoshi" and "amount_msat" in routes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-25 10:58:52 +10:30
parent 5ef4779edc
commit 5036605501
2 changed files with 1 additions and 19 deletions

View File

@ -53,10 +53,9 @@ static void param_add(struct param **params,
tal_arr_expand(params, last);
}
/* FIXME: To support the deprecated p_req_dup_ok */
static bool is_required(enum param_style style)
{
return style == PARAM_REQUIRED || style == PARAM_REQUIRED_ALLOW_DUPS;
return style == PARAM_REQUIRED;
}
static struct command_result *make_callback(struct command *cmd,
@ -176,8 +175,6 @@ static struct command_result *parse_by_name(struct command *cmd,
struct command_result *res;
if (p->is_set) {
if (p->style == PARAM_REQUIRED_ALLOW_DUPS)
continue;
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"duplicate json names: %s",
p->name);

View File

@ -83,7 +83,6 @@ const char *param_subcommand(struct command *cmd, const char *buffer,
enum param_style {
PARAM_REQUIRED,
PARAM_REQUIRED_ALLOW_DUPS,
PARAM_OPTIONAL,
PARAM_OPTIONAL_WITH_DEFAULT,
PARAM_OPTIONAL_DEV_WITH_DEFAULT,
@ -116,20 +115,6 @@ enum param_style {
(const jsmntok_t *)NULL, \
(arg)) == (struct command_result *)NULL); })
/*
* Add an required parameter, like p_req, but ignore duplicates.
*/
#define p_req_dup_ok(name, cbx, arg) \
name"", \
PARAM_REQUIRED_ALLOW_DUPS, \
(param_cbx)(cbx), \
({ *arg = NULL; \
(arg) + 0*sizeof((cbx)((struct command *)NULL, \
(const char *)NULL, \
(const char *)NULL, \
(const jsmntok_t *)NULL, \
(arg)) == (struct command_result *)NULL); })
/*
* Add an optional parameter. *arg is set to @def if it isn't found.
*/