mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
json: rename json_tok_bitcoin_amount.
json_tok* is used with 'struct command', so rename this to match the other low-level json tok helpers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -82,8 +82,8 @@ bool json_to_number(const char *buffer, const jsmntok_t *tok,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool json_tok_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
bool json_to_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||||
uint64_t *satoshi)
|
uint64_t *satoshi)
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
unsigned long btc, sat;
|
unsigned long btc, sat;
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ bool json_to_u64(const char *buffer, const jsmntok_t *tok,
|
|||||||
bool json_to_double(const char *buffer, const jsmntok_t *tok, double *num);
|
bool json_to_double(const char *buffer, const jsmntok_t *tok, double *num);
|
||||||
|
|
||||||
/* Extract satoshis from this (may be a string, or a decimal number literal) */
|
/* Extract satoshis from this (may be a string, or a decimal number literal) */
|
||||||
bool json_tok_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
bool json_to_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||||
uint64_t *satoshi);
|
uint64_t *satoshi);
|
||||||
|
|
||||||
/* Is this a number? [0..9]+ */
|
/* Is this a number? [0..9]+ */
|
||||||
bool json_tok_is_num(const char *buffer, const jsmntok_t *tok);
|
bool json_tok_is_num(const char *buffer, const jsmntok_t *tok);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static void do_json_tok_bitcoin_amount(const char* val, uint64_t expected)
|
|||||||
|
|
||||||
fprintf(stderr, "do_json_tok_bitcoin_amount(\"%s\", %"PRIu64"): ", val, expected);
|
fprintf(stderr, "do_json_tok_bitcoin_amount(\"%s\", %"PRIu64"): ", val, expected);
|
||||||
|
|
||||||
assert(json_tok_bitcoin_amount(val, &tok, &amount) == true);
|
assert(json_to_bitcoin_amount(val, &tok, &amount) == true);
|
||||||
assert(amount == expected);
|
assert(amount == expected);
|
||||||
|
|
||||||
fprintf(stderr, "ok\n");
|
fprintf(stderr, "ok\n");
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ static bool extract_feerate(struct bitcoin_cli *bcli,
|
|||||||
if (!feeratetok)
|
if (!feeratetok)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return json_tok_bitcoin_amount(output, feeratetok, feerate);
|
return json_to_bitcoin_amount(output, feeratetok, feerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct estimatefee {
|
struct estimatefee {
|
||||||
@@ -558,7 +558,7 @@ static bool process_gettxout(struct bitcoin_cli *bcli)
|
|||||||
bcli_args(tmpctx, bcli),
|
bcli_args(tmpctx, bcli),
|
||||||
(int)bcli->output_bytes, bcli->output);
|
(int)bcli->output_bytes, bcli->output);
|
||||||
|
|
||||||
if (!json_tok_bitcoin_amount(bcli->output, valuetok, &out.amount))
|
if (!json_to_bitcoin_amount(bcli->output, valuetok, &out.amount))
|
||||||
fatal("%s: had bad value (%.*s)?",
|
fatal("%s: had bad value (%.*s)?",
|
||||||
bcli_args(tmpctx, bcli),
|
bcli_args(tmpctx, bcli),
|
||||||
(int)bcli->output_bytes, bcli->output);
|
(int)bcli->output_bytes, bcli->output);
|
||||||
|
|||||||
Reference in New Issue
Block a user