Browse Source

json: Rename `json_tok_address_scriptpubkey` to `json_to_address_scriptpubkey`

Our json naming style is like `json_to_***`.
travis-debug
trueptolemy 5 years ago
committed by neil saitug
parent
commit
7db3f1b8a6
  1. 8
      lightningd/invoice.c
  2. 2
      lightningd/json.h
  3. 8
      lightningd/jsonrpc.c
  4. 6
      lightningd/test/run-invoice-select-inchan.c
  5. 16
      wallet/walletrpc.c

8
lightningd/invoice.c

@ -300,10 +300,10 @@ static struct command_result *parse_fallback(struct command *cmd,
enum address_parse_result fallback_parse; enum address_parse_result fallback_parse;
fallback_parse fallback_parse
= json_tok_address_scriptpubkey(cmd, = json_to_address_scriptpubkey(cmd,
get_chainparams(cmd->ld), get_chainparams(cmd->ld),
buffer, fallback, buffer, fallback,
fallback_script); fallback_script);
if (fallback_parse == ADDRESS_PARSE_UNRECOGNIZED) { if (fallback_parse == ADDRESS_PARSE_UNRECOGNIZED) {
return command_fail(cmd, LIGHTNINGD, return command_fail(cmd, LIGHTNINGD,
"Fallback address not valid"); "Fallback address not valid");

2
lightningd/json.h

@ -196,7 +196,7 @@ enum address_parse_result {
/* Return result of address parsing and fills in *scriptpubkey /* Return result of address parsing and fills in *scriptpubkey
* allocated off ctx if ADDRESS_PARSE_SUCCESS * 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 struct chainparams *chainparams,
const char *buffer, const char *buffer,
const jsmntok_t *tok, const u8 **scriptpubkey); const jsmntok_t *tok, const u8 **scriptpubkey);

8
lightningd/jsonrpc.c

@ -999,10 +999,10 @@ static const char *segwit_addr_net_decode(int *witness_version,
} }
enum address_parse_result enum address_parse_result
json_tok_address_scriptpubkey(const tal_t *ctx, json_to_address_scriptpubkey(const tal_t *ctx,
const struct chainparams *chainparams, const struct chainparams *chainparams,
const char *buffer, const char *buffer,
const jsmntok_t *tok, const u8 **scriptpubkey) const jsmntok_t *tok, const u8 **scriptpubkey)
{ {
struct bitcoin_address destination; struct bitcoin_address destination;
int witness_version; int witness_version;

6
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 */ /* Generated stub for json_stream_success */
struct json_stream *json_stream_success(struct command *cmd UNNEEDED) struct json_stream *json_stream_success(struct command *cmd UNNEEDED)
{ fprintf(stderr, "json_stream_success called!\n"); abort(); } { fprintf(stderr, "json_stream_success called!\n"); abort(); }
/* Generated stub for json_tok_address_scriptpubkey */ /* Generated stub for json_to_address_scriptpubkey */
enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx UNNEEDED, enum address_parse_result json_to_address_scriptpubkey(const tal_t *ctx UNNEEDED,
const struct chainparams *chainparams UNNEEDED, const struct chainparams *chainparams UNNEEDED,
const char *buffer UNNEEDED, const char *buffer UNNEEDED,
const jsmntok_t *tok UNNEEDED, const u8 **scriptpubkey 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 */ /* Generated stub for json_tok_channel_id */
bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct channel_id *cid UNNEEDED) struct channel_id *cid UNNEEDED)

16
wallet/walletrpc.c

@ -80,10 +80,10 @@ static struct command_result *param_bitcoin_address(struct command *cmd,
const u8 **scriptpubkey) const u8 **scriptpubkey)
{ {
/* Parse address. */ /* Parse address. */
switch (json_tok_address_scriptpubkey(cmd, switch (json_to_address_scriptpubkey(cmd,
get_chainparams(cmd->ld), get_chainparams(cmd->ld),
buffer, tok, buffer, tok,
scriptpubkey)) { scriptpubkey)) {
case ADDRESS_PARSE_UNRECOGNIZED: case ADDRESS_PARSE_UNRECOGNIZED:
return command_fail(cmd, LIGHTNINGD, return command_fail(cmd, LIGHTNINGD,
"Could not parse destination address, " "Could not parse destination address, "
@ -345,10 +345,10 @@ static struct command_result *json_prepare_tx(struct command *cmd,
"The output format must be " "The output format must be "
"{destination: amount}"); "{destination: amount}");
res = json_tok_address_scriptpubkey(cmd, res = json_to_address_scriptpubkey(cmd,
get_chainparams(cmd->ld), get_chainparams(cmd->ld),
buffer, &t[1], buffer, &t[1],
&destination); &destination);
if (res == ADDRESS_PARSE_UNRECOGNIZED) if (res == ADDRESS_PARSE_UNRECOGNIZED)
return command_fail(cmd, JSONRPC2_INVALID_PARAMS, return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"Could not parse destination address"); "Could not parse destination address");

Loading…
Cancel
Save