mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
xpay-handle-pay: don't assume bolt11 is non NULL
Changelog-None: xpay-handle-pay: don't assume bolt11 param is non NULL Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
This commit is contained in:
parent
a272258fb6
commit
21195be3f7
1 changed files with 17 additions and 14 deletions
|
@ -1912,6 +1912,9 @@ static struct command_result *handle_rpc_command(struct command *cmd,
|
|||
const char *maxfee = NULL;
|
||||
struct json_stream *response;
|
||||
|
||||
/* pay extra params */
|
||||
const jsmntok_t *maxfeepercent = NULL, *exemptfee = NULL;
|
||||
|
||||
if (!xpay->take_over_pay)
|
||||
goto dont_redirect;
|
||||
|
||||
|
@ -1945,7 +1948,7 @@ static struct command_result *handle_rpc_command(struct command *cmd,
|
|||
if (amount_msat && json_tok_is_null(buf, amount_msat))
|
||||
amount_msat = NULL;
|
||||
} else if (params_tok->type == JSMN_OBJECT) {
|
||||
const jsmntok_t *t, *maxfeepercent = NULL, *exemptfee = NULL;
|
||||
const jsmntok_t *t;
|
||||
size_t i;
|
||||
|
||||
json_for_each_obj(i, t, params_tok) {
|
||||
|
@ -1973,25 +1976,25 @@ static struct command_result *handle_rpc_command(struct command *cmd,
|
|||
goto dont_redirect;
|
||||
}
|
||||
}
|
||||
if (!bolt11) {
|
||||
plugin_log(cmd->plugin, LOG_INFORM,
|
||||
"Not redirecting pay (missing bolt11 parameter)");
|
||||
goto dont_redirect;
|
||||
}
|
||||
/* If this returns NULL, we let pay handle the weird case */
|
||||
if (!calc_maxfee(cmd, &maxfee, buf,
|
||||
bolt11, amount_msat,
|
||||
exemptfee, maxfeepercent)) {
|
||||
plugin_log(cmd->plugin, LOG_INFORM,
|
||||
"Not redirecting pay (weird maxfee params)");
|
||||
goto dont_redirect;
|
||||
}
|
||||
} else {
|
||||
plugin_log(cmd->plugin, LOG_INFORM,
|
||||
"Not redirecting pay (unexpected params type)");
|
||||
goto dont_redirect;
|
||||
}
|
||||
|
||||
if (!bolt11) {
|
||||
plugin_log(cmd->plugin, LOG_INFORM,
|
||||
"Not redirecting pay (missing bolt11 parameter)");
|
||||
goto dont_redirect;
|
||||
}
|
||||
/* If this returns NULL, we let pay handle the weird case */
|
||||
if (!calc_maxfee(cmd, &maxfee, buf, bolt11, amount_msat, exemptfee,
|
||||
maxfeepercent)) {
|
||||
plugin_log(cmd->plugin, LOG_INFORM,
|
||||
"Not redirecting pay (weird maxfee params)");
|
||||
goto dont_redirect;
|
||||
}
|
||||
|
||||
plugin_log(cmd->plugin, LOG_INFORM, "Redirecting pay->xpay");
|
||||
response = jsonrpc_stream_success(cmd);
|
||||
json_object_start(response, "replace");
|
||||
|
|
Loading…
Add table
Reference in a new issue