mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 06:44:24 +01:00
param: make json_tok_ handlers all return command_result, rename to param_
Handers of a specific form are both designed to be used as callbacks for param(), and also dispose of the command if something goes wrong. Make them return the 'struct command_result *' from command_failed(), or NULL. Renaming them just makes sense: json_tok_XXX is used for non-command-freeing parsers too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -609,15 +609,15 @@ static void json_pay(struct command *cmd,
|
||||
unsigned int *exemptfee;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
p_req("bolt11", json_tok_string, &b11str),
|
||||
p_opt("msatoshi", json_tok_u64, &msatoshi),
|
||||
p_opt("description", json_tok_string, &desc),
|
||||
p_opt_def("riskfactor", json_tok_double, &riskfactor, 1.0),
|
||||
p_opt_def("maxfeepercent", json_tok_percent, &maxfeepercent, 0.5),
|
||||
p_opt_def("retry_for", json_tok_number, &retryfor, 60),
|
||||
p_opt_def("maxdelay", json_tok_number, &maxdelay,
|
||||
p_req("bolt11", param_string, &b11str),
|
||||
p_opt("msatoshi", param_u64, &msatoshi),
|
||||
p_opt("description", param_string, &desc),
|
||||
p_opt_def("riskfactor", param_double, &riskfactor, 1.0),
|
||||
p_opt_def("maxfeepercent", param_percent, &maxfeepercent, 0.5),
|
||||
p_opt_def("retry_for", param_number, &retryfor, 60),
|
||||
p_opt_def("maxdelay", param_number, &maxdelay,
|
||||
cmd->ld->config.locktime_max),
|
||||
p_opt_def("exemptfee", json_tok_number, &exemptfee, 5000),
|
||||
p_opt_def("exemptfee", param_number, &exemptfee, 5000),
|
||||
NULL))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user