msat: cleanup msat outputs for apis

Don't use the _str() option for msat outputs, use the built-in helpers
which are deprecation aware.

Fixes #5447

Reported-By: @fiatjaf
This commit is contained in:
niftynei
2022-07-22 12:26:00 -05:00
committed by Rusty Russell
parent b6bf352503
commit bb4da47131
2 changed files with 5 additions and 6 deletions

View File

@@ -399,11 +399,10 @@ static void add_new_entry(struct json_stream *ret,
/* This is only tallied for pending and successful payments, not
* failures. */
if (pm->amount != NULL && pm->num_nonfailed_parts > 0)
json_add_string(ret, "amount_msat",
fmt_amount_msat(tmpctx, *pm->amount));
json_add_amount_msat_only(ret, "amount_msat", *pm->amount);
json_add_string(ret, "amount_sent_msat",
fmt_amount_msat(tmpctx, pm->amount_sent));
json_add_amount_msat_only(ret, "amount_sent_msat",
pm->amount_sent);
if (pm->num_nonfailed_parts > 1)
json_add_u64(ret, "number_of_parts",

View File

@@ -1117,8 +1117,8 @@ fundchannel_start_dest(struct multifundchannel_destination *dest)
json_add_string(req->js, "feerate", mfc->feerate_str);
json_add_bool(req->js, "announce", dest->announce);
json_add_string(req->js, "push_msat",
fmt_amount_msat(tmpctx, dest->push_msat));
json_add_amount_msat_only(req->js, "push_msat", dest->push_msat);
if (dest->close_to_str)
json_add_string(req->js, "close_to", dest->close_to_str);