bkpr: add 'msat' suffix to all msat denominated fields

Makes our json schema parsing work as expected.
This commit is contained in:
niftynei
2022-07-19 17:04:39 +09:30
committed by Rusty Russell
parent d885407e3e
commit e2ef44c043
8 changed files with 44 additions and 44 deletions

View File

@@ -280,10 +280,10 @@ static struct command_result *json_inspect(struct command *cmd,
fee_sum = find_sum_for_txid(fee_sums, set->txid);
if (fee_sum)
json_add_amount_msat_only(res, "fees_paid",
json_add_amount_msat_only(res, "fees_paid_msat",
fee_sum->fees_paid);
else
json_add_amount_msat_only(res, "fees_paid",
json_add_amount_msat_only(res, "fees_paid_msat",
AMOUNT_MSAT(0));
json_array_start(res, "outputs");
@@ -311,9 +311,9 @@ static struct command_result *json_inspect(struct command *cmd,
json_add_num(res, "outnum",
ev->outpoint.n);
json_add_string(res, "output_tag", ev->tag);
json_add_amount_msat_only(res, "output_value",
json_add_amount_msat_only(res, "output_value_msat",
ev->output_value);
json_add_amount_msat_only(res, "credit",
json_add_amount_msat_only(res, "credit_msat",
ev->credit);
json_add_string(res, "currency", ev->currency);
if (ev->origin_acct)
@@ -328,7 +328,7 @@ static struct command_result *json_inspect(struct command *cmd,
ev->acct_name);
json_add_num(res, "outnum",
ev->outpoint.n);
json_add_amount_msat_only(res, "output_value",
json_add_amount_msat_only(res, "output_value_msat",
ev->output_value);
json_add_string(res, "currency",
ev->currency);
@@ -336,7 +336,7 @@ static struct command_result *json_inspect(struct command *cmd,
json_add_string(res, "spend_tag", ev->tag);
json_add_txid(res, "spending_txid",
ev->spending_txid);
json_add_amount_msat_only(res, "debit", ev->debit);
json_add_amount_msat_only(res, "debit_msat", ev->debit);
if (ev->payment_id)
json_add_sha256(res, "payment_id",
ev->payment_id);
@@ -499,7 +499,7 @@ static struct command_result *json_list_balances(struct command *cmd,
json_array_start(res, "balances");
for (size_t j = 0; j < tal_count(balances); j++) {
json_object_start(res, NULL);
json_add_amount_msat_only(res, "balance",
json_add_amount_msat_only(res, "balance_msat",
balances[j]->balance);
json_add_string(res, "coin_type",
balances[j]->currency);

View File

@@ -11,8 +11,8 @@ void json_add_chain_event(struct json_stream *out, struct chain_event *ev)
json_add_string(out, "origin", ev->origin_acct);
json_add_string(out, "type", "chain");
json_add_string(out, "tag", ev->tag);
json_add_amount_msat_only(out, "credit", ev->credit);
json_add_amount_msat_only(out, "debit", ev->debit);
json_add_amount_msat_only(out, "credit_msat", ev->credit);
json_add_amount_msat_only(out, "debit_msat", ev->debit);
json_add_string(out, "currency", ev->currency);
json_add_outpoint(out, "outpoint", &ev->outpoint);

View File

@@ -37,10 +37,10 @@ void json_add_channel_event(struct json_stream *out,
json_add_string(out, "account", ev->acct_name);
json_add_string(out, "type", "channel");
json_add_string(out, "tag", ev->tag);
json_add_amount_msat_only(out, "credit", ev->credit);
json_add_amount_msat_only(out, "debit", ev->debit);
json_add_amount_msat_only(out, "credit_msat", ev->credit);
json_add_amount_msat_only(out, "debit_msat", ev->debit);
if (!amount_msat_zero(ev->fees))
json_add_amount_msat_only(out, "fees", ev->fees);
json_add_amount_msat_only(out, "fees_msat", ev->fees);
json_add_string(out, "currency", ev->currency);
if (ev->payment_id)
json_add_sha256(out, "payment_id", ev->payment_id);

View File

@@ -301,21 +301,21 @@ void json_add_channel_apy(struct json_stream *res,
json_add_string(res, "account", apy->acct_name);
json_add_amount_msat_only(res, "routed_out", apy->routed_out);
json_add_amount_msat_only(res, "routed_in", apy->routed_in);
json_add_amount_msat_only(res, "lease_fee_paid", apy->lease_out);
json_add_amount_msat_only(res, "lease_fee_earned", apy->lease_in);
json_add_amount_msat_only(res, "pushed_out", apy->push_out);
json_add_amount_msat_only(res, "pushed_in", apy->push_in);
json_add_amount_msat_only(res, "routed_out_msat", apy->routed_out);
json_add_amount_msat_only(res, "routed_in_msat", apy->routed_in);
json_add_amount_msat_only(res, "lease_fee_paid_msat", apy->lease_out);
json_add_amount_msat_only(res, "lease_fee_earned_msat", apy->lease_in);
json_add_amount_msat_only(res, "pushed_out_msat", apy->push_out);
json_add_amount_msat_only(res, "pushed_in_msat", apy->push_in);
json_add_amount_msat_only(res, "our_start_balance", apy->our_start_bal);
json_add_amount_msat_only(res, "channel_start_balance",
json_add_amount_msat_only(res, "our_start_balance_msat", apy->our_start_bal);
json_add_amount_msat_only(res, "channel_start_balance_msat",
apy->total_start_bal);
ok = amount_msat_add(&total_fees, apy->fees_in, apy->fees_out);
assert(ok);
json_add_amount_msat_only(res, "fees_out", apy->fees_out);
json_add_amount_msat_only(res, "fees_in", apy->fees_in);
json_add_amount_msat_only(res, "fees_out_msat", apy->fees_out);
json_add_amount_msat_only(res, "fees_in_msat", apy->fees_in);
/* utilization (out): routed_out/total_balance */
assert(!amount_msat_zero(apy->total_start_bal));

View File

@@ -392,8 +392,8 @@ void json_add_income_event(struct json_stream *out, struct income_event *ev)
json_object_start(out, NULL);
json_add_string(out, "account", ev->acct_name);
json_add_string(out, "tag", ev->tag);
json_add_amount_msat_only(out, "credit", ev->credit);
json_add_amount_msat_only(out, "debit", ev->debit);
json_add_amount_msat_only(out, "credit_msat", ev->credit);
json_add_amount_msat_only(out, "debit_msat", ev->debit);
json_add_string(out, "currency", ev->currency);
json_add_u64(out, "timestamp", ev->timestamp);

View File

@@ -10,8 +10,8 @@ void json_add_onchain_fee(struct json_stream *out,
json_add_string(out, "account", fee->acct_name);
json_add_string(out, "type", "onchain_fee");
json_add_string(out, "tag", "onchain_fee");
json_add_amount_msat_only(out, "credit", fee->credit);
json_add_amount_msat_only(out, "debit", fee->debit);
json_add_amount_msat_only(out, "credit_msat", fee->credit);
json_add_amount_msat_only(out, "debit_msat", fee->debit);
json_add_string(out, "currency", fee->currency);
json_add_u64(out, "timestamp", fee->timestamp);
json_add_txid(out, "txid", &fee->txid);