json: move param node_id parser to common

Going to need this for a plugin that's external
This commit is contained in:
lisa neigut
2019-08-27 22:23:14 -05:00
committed by Rusty Russell
parent 8d28e52515
commit 19e65068a9
6 changed files with 28 additions and 27 deletions

View File

@@ -77,23 +77,6 @@ void json_add_txid(struct json_stream *result, const char *fieldname,
json_add_string(result, fieldname, hex);
}
struct command_result *param_node_id(struct command *cmd,
const char *name,
const char *buffer,
const jsmntok_t *tok,
struct node_id **id)
{
*id = tal(cmd, struct node_id);
if (json_to_node_id(buffer, tok, *id))
return NULL;
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"'%s' should be a node id, not '%.*s'",
name, json_tok_full_len(tok),
json_tok_full(buffer, tok));
}
struct command_result *param_pubkey(struct command *cmd, const char *name,
const char *buffer, const jsmntok_t *tok,
struct pubkey **pubkey)