diff --git a/common/json_tok.c b/common/json_tok.c index 788fe8b26..e30dfc35b 100644 --- a/common/json_tok.c +++ b/common/json_tok.c @@ -206,6 +206,20 @@ struct command_result *param_channel_id(struct command *cmd, const char *name, "should be a channel id"); } +struct command_result *param_short_channel_id(struct command *cmd, + const char *name, + const char *buffer, + const jsmntok_t *tok, + struct short_channel_id **scid) +{ + *scid = tal(cmd, struct short_channel_id); + if (json_to_short_channel_id(buffer, tok, *scid)) + return NULL; + + return command_fail_badparam(cmd, name, buffer, tok, + "should be a short_channel_id of form NxNxN"); +} + struct command_result *param_secret(struct command *cmd, const char *name, const char *buffer, const jsmntok_t *tok, struct secret **secret) diff --git a/common/json_tok.h b/common/json_tok.h index 2fe336913..394b2d7c0 100644 --- a/common/json_tok.h +++ b/common/json_tok.h @@ -99,6 +99,13 @@ struct command_result *param_channel_id(struct command *cmd, const char *buffer, const jsmntok_t *tok, struct channel_id **cid); + +struct command_result *param_short_channel_id(struct command *cmd, + const char *name, + const char *buffer, + const jsmntok_t *tok, + struct short_channel_id **scid); + /* * Set the address of @out to @tok. Used as a callback by handlers that * want to unmarshal @tok themselves. diff --git a/common/test/run-param.c b/common/test/run-param.c index 091568f20..0ccbeff25 100644 --- a/common/test/run-param.c +++ b/common/test/run-param.c @@ -61,6 +61,10 @@ bool json_to_outpoint(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED bool json_to_pubkey(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct pubkey *pubkey UNNEEDED) { fprintf(stderr, "json_to_pubkey called!\n"); abort(); } +/* Generated stub for json_to_short_channel_id */ +bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, + struct short_channel_id *scid UNNEEDED) +{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } /* Generated stub for json_to_txid */ bool json_to_txid(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct bitcoin_txid *txid UNNEEDED) diff --git a/lightningd/json.c b/lightningd/json.c index 98f053f75..6ff481681 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -35,20 +35,6 @@ struct command_result *param_pubkey(struct command *cmd, const char *name, "should be a compressed pubkey"); } -struct command_result *param_short_channel_id(struct command *cmd, - const char *name, - const char *buffer, - const jsmntok_t *tok, - struct short_channel_id **scid) -{ - *scid = tal(cmd, struct short_channel_id); - if (json_to_short_channel_id(buffer, tok, *scid)) - return NULL; - - return command_fail_badparam(cmd, name, buffer, tok, - "should be a short_channel_id of form NxNxN"); -} - struct command_result *param_feerate_style(struct command *cmd, const char *name, const char *buffer, diff --git a/lightningd/test/run-jsonrpc.c b/lightningd/test/run-jsonrpc.c index 94d76b9d5..0ab70c68b 100644 --- a/lightningd/test/run-jsonrpc.c +++ b/lightningd/test/run-jsonrpc.c @@ -34,10 +34,6 @@ void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname bool json_to_pubkey(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct pubkey *pubkey UNNEEDED) { fprintf(stderr, "json_to_pubkey called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id */ -bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } /* Generated stub for log_ */ void log_(struct log *log UNNEEDED, enum log_level level UNNEEDED, const struct node_id *node_id UNNEEDED,