JSON: don't print deprecated amount fields any more

A small change in one routine creates a lot of changes!  We actually
recommended moving away from these in v0.7.0 (2019-02-28), but never
deprecated them formally.

Changelog-Deprecated: JSON-RPC: `pay`, `decode`, `decodepay`, `getroute`, `listinvoices`, `listpays` and `listsendpays` `msatoshi` fields (use `amount_msat`).
Changelog-Deprecated: JSON-RPC: `getinfo` `msatoshi_fees_collected` field (use `fees_collected_msat`).
Changelog-Deprecated: JSON-RPC: `listpeers` `channels`: `msatoshi_to_us`, `msatoshi_to_us_min`, `msatoshi_to_us_max`, `msatoshi_total`, `dust_limit_satoshis`, `our_channel_reserve_satoshis`, `their_channel_reserve_satoshis`, `spendable_msatoshi`, `receivable_msatoshi`, `in_msatoshi_offered`, `in_msatoshi_fulfilled`, `out_msatoshi_offered`, `out_msatoshi_fulfilled`, `max_htlc_value_in_flight_msat` and `htlc_minimum_msat` (use `to_us_msat`, `min_to_us_msat`, `max_to_us_msat`, `total_msat`, `dust_limit_msat`, `our_reserve_msat`, `their_reserve_msat`, `spendable_msat`, `receivable_msat`, `in_offered_msat`, `in_fulfilled_msat`, `out_offered_msat`, `out_fulfilled_msat`, `max_total_htlc_in_msat` and `minimum_htlc_in_msat`).
Changelog-Deprecated: JSON-RPC: `listinvoices` and `pay` `msatoshi_received` and `msatoshi_sent` (use `amount_received_msat`, `amount_sent_msat`)
Changelog-Deprecated: JSON-RPC: `listpays` and `listsendpays` `msatoshi_sent` (use `amount_sent_msat`)
Changelog-Deprecated: JSON-RPC: `listforwards` `in_msatoshi`, `out_msatoshi` and `fee` (use `in_msat`, `out_msat` and `fee_msat`)
Changelog-Deprecated: JSON-RPC: `listfunds` `outputs` `value` (use `amount_msat`)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-06-20 19:52:09 +09:30
parent 6afc0affef
commit c3efba16ff
7 changed files with 11 additions and 25 deletions

View File

@@ -401,9 +401,8 @@ void json_add_amount_msat_compat(struct json_stream *result,
const char *rawfieldname,
const char *msatfieldname)
{
json_add_u64(result, rawfieldname, msat.millisatoshis); /* Raw: low-level helper */
if (!deprecated_apis)
assert(strends(msatfieldname, "_msat"));
if (deprecated_apis)
json_add_u64(result, rawfieldname, msat.millisatoshis); /* Raw: low-level helper */
json_add_amount_msat_only(result, msatfieldname, msat);
}
@@ -422,7 +421,8 @@ void json_add_amount_sat_compat(struct json_stream *result,
const char *rawfieldname,
const char *msatfieldname)
{
json_add_u64(result, rawfieldname, sat.satoshis); /* Raw: low-level helper */
if (deprecated_apis)
json_add_u64(result, rawfieldname, sat.satoshis); /* Raw: low-level helper */
json_add_amount_sat_msat(result, msatfieldname, sat);
}
@@ -433,8 +433,7 @@ void json_add_amount_sat_msat(struct json_stream *result,
struct amount_msat msat;
assert(strends(msatfieldname, "_msat"));
if (amount_sat_to_msat(&msat, sat))
json_add_string(result, msatfieldname,
type_to_string(tmpctx, struct amount_msat, &msat));
json_add_amount_msat_only(result, msatfieldname, msat);
}
/* When I noticed that we were adding "XXXmsat" fields *not* ending in _msat */