mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
json-rpc: Remove upper limit for percentage
The `json_tok_percentage` parser is used for the `fuzzpercent` in `getroute` and `maxfeepercent` in `pay`. In both cases it seems reasonable to allow values larger than 100%. This has bitten users in the past when they transferred single satoshis to things like satoshis.place over a route longer than 2 hops.
This commit is contained in:
committed by
Rusty Russell
parent
60b51d29b6
commit
cf52b7161f
@@ -238,12 +238,11 @@ bool json_tok_percent(struct command *cmd, const char *name,
|
||||
double **num)
|
||||
{
|
||||
*num = tal(cmd, double);
|
||||
if (json_to_double(buffer, tok, *num))
|
||||
if (**num >= 0.0 && **num <= 100.0)
|
||||
return true;
|
||||
if (json_to_double(buffer, tok, *num) && **num >= 0.0)
|
||||
return true;
|
||||
|
||||
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"'%s' should be a double in range [0.0, 100.0], not '%.*s'",
|
||||
"'%s' should be a positive double, not '%.*s'",
|
||||
name, tok->end - tok->start, buffer + tok->start);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user