mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 09:34:24 +01:00
keysend: Allow quoted numbers in extratlvs
This is because JSON technically does not allow numeric keys in maps. Changelog-Added: JSON-RPC: The `extratlvs` argument for `keysend` now allows quoting the type numbers in string
This commit is contained in:
@@ -883,7 +883,11 @@ struct command_result *param_extra_tlvs(struct command *cmd, const char *name,
|
||||
temp = tal_arr(cmd, struct tlv_field, tok->size);
|
||||
json_for_each_obj(i, curr, tok) {
|
||||
f = &temp[i];
|
||||
if (!json_to_u64(buffer, curr, &f->numtype)) {
|
||||
/* Accept either bare ints as keys (not spec
|
||||
* compliant, but simpler), or ints in strings, which
|
||||
* are JSON spec compliant. */
|
||||
if (!(json_str_to_u64(buffer, curr, &f->numtype) ||
|
||||
json_to_u64(buffer, curr, &f->numtype))) {
|
||||
return command_fail(
|
||||
cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"\"%s\" is not a valid numeric TLV type.",
|
||||
|
||||
Reference in New Issue
Block a user