mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 23:04:35 +01:00
json: add a param parser for a txid
This commit is contained in:
committed by
Rusty Russell
parent
c40250ad0b
commit
a4a193840f
@@ -108,6 +108,21 @@ struct command_result *param_pubkey(struct command *cmd, const char *name,
|
||||
json_tok_full(buffer, tok));
|
||||
}
|
||||
|
||||
struct command_result *param_txid(struct command *cmd,
|
||||
const char *name,
|
||||
const char *buffer,
|
||||
const jsmntok_t *tok,
|
||||
struct bitcoin_txid **txid)
|
||||
{
|
||||
*txid = tal(cmd, struct bitcoin_txid);
|
||||
if (json_to_txid(buffer, tok, *txid))
|
||||
return NULL;
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"'%s' should be txid, not '%.*s'",
|
||||
name, json_tok_full_len(tok),
|
||||
json_tok_full(buffer, tok));
|
||||
}
|
||||
|
||||
void json_add_short_channel_id(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct short_channel_id *scid)
|
||||
|
||||
Reference in New Issue
Block a user