mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
json: Add parser for u32 params
This commit is contained in:
parent
bad943da55
commit
6d07f4ed85
2 changed files with 17 additions and 0 deletions
|
@ -122,6 +122,18 @@ struct command_result *param_sha256(struct command *cmd, const char *name,
|
|||
"should be a 32 byte hex value");
|
||||
}
|
||||
|
||||
struct command_result *param_u32(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
uint32_t **num)
|
||||
{
|
||||
*num = tal(cmd, uint32_t);
|
||||
if (json_to_u32(buffer, tok, *num))
|
||||
return NULL;
|
||||
|
||||
return command_fail_badparam(cmd, name, buffer, tok,
|
||||
"should be an unsigned 32 bit integer");
|
||||
}
|
||||
|
||||
struct command_result *param_u64(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
uint64_t **num)
|
||||
|
|
|
@ -68,6 +68,11 @@ struct command_result *param_sha256(struct command *cmd, const char *name,
|
|||
const char *buffer, const jsmntok_t *tok,
|
||||
struct sha256 **hash);
|
||||
|
||||
/* Extract number from this (may be a string, or a number literal) */
|
||||
struct command_result *param_u32(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
uint32_t **num);
|
||||
|
||||
/* Extract number from this (may be a string, or a number literal) */
|
||||
struct command_result *param_u64(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
|
|
Loading…
Add table
Reference in a new issue