From bb4da47131c9c578fdea52640653b2d8bce62256 Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 22 Jul 2022 12:26:00 -0500 Subject: [PATCH] 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 --- plugins/pay.c | 7 +++---- plugins/spender/multifundchannel.c | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/pay.c b/plugins/pay.c index 0e309b33b..fc39b8bb3 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -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", diff --git a/plugins/spender/multifundchannel.c b/plugins/spender/multifundchannel.c index 4b9c1c6c3..e67baed0e 100644 --- a/plugins/spender/multifundchannel.c +++ b/plugins/spender/multifundchannel.c @@ -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);