mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
param: getroute fuzz now uses json_tok_percent
Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
committed by
Rusty Russell
parent
c32f7910cc
commit
c553bba7a8
@@ -159,6 +159,21 @@ bool json_tok_sha256(struct command *cmd, const char *name,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool json_tok_percent(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
double **num)
|
||||
{
|
||||
*num = tal(cmd, double);
|
||||
if (json_to_double(buffer, tok, *num))
|
||||
if (**num >= 0.0 && **num >= 100.0)
|
||||
return true;
|
||||
|
||||
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"'%s' should be a double in range [0.0, 100.0], not '%.*s'",
|
||||
name, tok->end - tok->start, buffer + tok->start);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool json_tok_u64(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
uint64_t **num)
|
||||
|
||||
Reference in New Issue
Block a user