mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
param: added json_tok_msat
This could have been a local static but its used by the run-param test, so putting it in json.c made things easier. Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
committed by
Rusty Russell
parent
c553bba7a8
commit
4f81cd3852
@@ -413,29 +413,6 @@ static void sendpay_nulltok(void)
|
||||
assert(msatoshi == NULL);
|
||||
}
|
||||
|
||||
static bool json_tok_msat(struct command *cmd,
|
||||
const char *name,
|
||||
const char *buffer,
|
||||
const jsmntok_t * tok,
|
||||
u64 **msatoshi_val)
|
||||
{
|
||||
if (json_tok_streq(buffer, tok, "any")) {
|
||||
*msatoshi_val = NULL;
|
||||
return true;
|
||||
}
|
||||
*msatoshi_val = tal(cmd, u64);
|
||||
|
||||
if (json_to_u64(buffer, tok, *msatoshi_val) && *msatoshi_val != 0)
|
||||
return true;
|
||||
|
||||
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"'%s' should be a positive number or 'any', not '%.*s'",
|
||||
name,
|
||||
tok->end - tok->start,
|
||||
buffer + tok->start);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* New version of json_tok_label conforming to advanced style. This can eventually
|
||||
* replace the existing json_tok_label.
|
||||
|
||||
Reference in New Issue
Block a user