From 7db3f1b8a6e2cce147c9d12a57785e44e3902154 Mon Sep 17 00:00:00 2001 From: trueptolemy Date: Sun, 6 Oct 2019 20:12:41 +0800 Subject: [PATCH] json: Rename `json_tok_address_scriptpubkey` to `json_to_address_scriptpubkey` Our json naming style is like `json_to_***`. --- lightningd/invoice.c | 8 ++++---- lightningd/json.h | 2 +- lightningd/jsonrpc.c | 8 ++++---- lightningd/test/run-invoice-select-inchan.c | 6 +++--- wallet/walletrpc.c | 16 ++++++++-------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lightningd/invoice.c b/lightningd/invoice.c index c021e0048..f04491346 100644 --- a/lightningd/invoice.c +++ b/lightningd/invoice.c @@ -300,10 +300,10 @@ static struct command_result *parse_fallback(struct command *cmd, enum address_parse_result fallback_parse; fallback_parse - = json_tok_address_scriptpubkey(cmd, - get_chainparams(cmd->ld), - buffer, fallback, - fallback_script); + = json_to_address_scriptpubkey(cmd, + get_chainparams(cmd->ld), + buffer, fallback, + fallback_script); if (fallback_parse == ADDRESS_PARSE_UNRECOGNIZED) { return command_fail(cmd, LIGHTNINGD, "Fallback address not valid"); diff --git a/lightningd/json.h b/lightningd/json.h index 6ede9b5fc..e6e613a1b 100644 --- a/lightningd/json.h +++ b/lightningd/json.h @@ -196,7 +196,7 @@ enum address_parse_result { /* Return result of address parsing and fills in *scriptpubkey * allocated off ctx if ADDRESS_PARSE_SUCCESS */ -enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx, +enum address_parse_result json_to_address_scriptpubkey(const tal_t *ctx, const struct chainparams *chainparams, const char *buffer, const jsmntok_t *tok, const u8 **scriptpubkey); diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index c5c7fa7da..ee6d5a72e 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -999,10 +999,10 @@ static const char *segwit_addr_net_decode(int *witness_version, } enum address_parse_result -json_tok_address_scriptpubkey(const tal_t *ctx, - const struct chainparams *chainparams, - const char *buffer, - const jsmntok_t *tok, const u8 **scriptpubkey) +json_to_address_scriptpubkey(const tal_t *ctx, + const struct chainparams *chainparams, + const char *buffer, + const jsmntok_t *tok, const u8 **scriptpubkey) { struct bitcoin_address destination; int witness_version; diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index 21af79a97..5eaf69390 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -233,12 +233,12 @@ struct json_stream *json_stream_fail(struct command *cmd UNNEEDED, /* Generated stub for json_stream_success */ struct json_stream *json_stream_success(struct command *cmd UNNEEDED) { fprintf(stderr, "json_stream_success called!\n"); abort(); } -/* Generated stub for json_tok_address_scriptpubkey */ -enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx UNNEEDED, +/* Generated stub for json_to_address_scriptpubkey */ +enum address_parse_result json_to_address_scriptpubkey(const tal_t *ctx UNNEEDED, const struct chainparams *chainparams UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, const u8 **scriptpubkey UNNEEDED) -{ fprintf(stderr, "json_tok_address_scriptpubkey called!\n"); abort(); } +{ fprintf(stderr, "json_to_address_scriptpubkey called!\n"); abort(); } /* Generated stub for json_tok_channel_id */ bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct channel_id *cid UNNEEDED) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 112c949a7..5d3f67341 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -80,10 +80,10 @@ static struct command_result *param_bitcoin_address(struct command *cmd, const u8 **scriptpubkey) { /* Parse address. */ - switch (json_tok_address_scriptpubkey(cmd, - get_chainparams(cmd->ld), - buffer, tok, - scriptpubkey)) { + switch (json_to_address_scriptpubkey(cmd, + get_chainparams(cmd->ld), + buffer, tok, + scriptpubkey)) { case ADDRESS_PARSE_UNRECOGNIZED: return command_fail(cmd, LIGHTNINGD, "Could not parse destination address, " @@ -345,10 +345,10 @@ static struct command_result *json_prepare_tx(struct command *cmd, "The output format must be " "{destination: amount}"); - res = json_tok_address_scriptpubkey(cmd, - get_chainparams(cmd->ld), - buffer, &t[1], - &destination); + res = json_to_address_scriptpubkey(cmd, + get_chainparams(cmd->ld), + buffer, &t[1], + &destination); if (res == ADDRESS_PARSE_UNRECOGNIZED) return command_fail(cmd, JSONRPC2_INVALID_PARAMS, "Could not parse destination address");