diff --git a/common/json_helpers.c b/common/json_helpers.c index 3b1e210ce..aaf601435 100644 --- a/common/json_helpers.c +++ b/common/json_helpers.c @@ -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 */ diff --git a/doc/lightning-listfunds.7.md b/doc/lightning-listfunds.7.md index d2dc247fd..1ce69088b 100644 --- a/doc/lightning-listfunds.7.md +++ b/doc/lightning-listfunds.7.md @@ -68,4 +68,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:e2b4f817ca6032ab4421fccaba226c03e0995c8dbfbfeb2f7c8572987ffe7dc4) +[comment]: # ( SHA256STAMP:fdc550a0ff11f6fbbf51c29340c0494077d831566ae7ab008cce4b93034a76c5) diff --git a/doc/schemas/listfunds.schema.json b/doc/schemas/listfunds.schema.json index bd1f73382..5ebd497af 100644 --- a/doc/schemas/listfunds.schema.json +++ b/doc/schemas/listfunds.schema.json @@ -33,10 +33,6 @@ "type": "msat", "description": "the amount of the output" }, - "value": { - "type": "u64", - "deprecated": true - }, "scriptpubkey": { "type": "hex", "description": "the scriptPubkey of the output" diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 0b1cd7619..750bdd63b 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -2019,7 +2019,6 @@ def test_gossip_store_upgrade_v7_v8(node_factory): 'destination': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'short_channel_id': '103x1x1', 'public': False, - 'satoshis': 1000000, 'amount_msat': Millisatoshi(1000000000), 'message_flags': 1, 'channel_flags': 0, @@ -2036,7 +2035,6 @@ def test_gossip_store_upgrade_v7_v8(node_factory): 'destination': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'short_channel_id': '103x1x1', 'public': False, - 'satoshis': 1000000, 'amount_msat': Millisatoshi(1000000000), 'message_flags': 1, 'channel_flags': 1, diff --git a/tests/test_misc.py b/tests/test_misc.py index 793c6fb5f..e2ac16fd7 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -969,7 +969,6 @@ def test_cli(node_factory): ' "invoices": [', ' {', r' "label": "l\"[]{}",', - ' "msatoshi": 123000,', ' "amount_msat": "123000msat",', ' "status": "unpaid",', r' "description": "d\"[]{}",', diff --git a/tests/test_pay.py b/tests/test_pay.py index d1037f293..159a63db6 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -1292,11 +1292,9 @@ def test_forward_pad_fees_and_cltv(node_factory, bitcoind): assert route[1]['delay'] == 9 # Modify so we overpay, overdo the cltv. - route[0]['msatoshi'] += 2000 - route[0]['amount_msat'] = Millisatoshi(route[0]['msatoshi']) + route[0]['amount_msat'] += 2000 route[0]['delay'] += 20 - route[1]['msatoshi'] += 1000 - route[1]['amount_msat'] = Millisatoshi(route[1]['msatoshi']) + route[1]['amount_msat'] += 1000 route[1]['delay'] += 10 # This should work. @@ -2174,13 +2172,11 @@ def test_setchannel_routing(node_factory, bitcoind): # 1337 + 4000000 * 137 / 1000000 = 1885 route_ok = l1.rpc.getroute(l3.info['id'], 4000000, 1)["route"] assert len(route_ok) == 2 - assert route_ok[0]['msatoshi'] == 4001885 - assert route_ok[1]['msatoshi'] == 4000000 + assert route_ok[0]['amount_msat'] == 4001885 + assert route_ok[1]['amount_msat'] == 4000000 # Make variant that tries to pay more than allowed htlc! route_bad = copy.deepcopy(route_ok) - route_bad[0]['msatoshi'] = 4001887 - route_bad[1]['msatoshi'] = 4000001 route_bad[0]['amount_msat'] = Millisatoshi(4001887) route_bad[1]['amount_msat'] = Millisatoshi(4000001) assert route_bad != route_ok @@ -2211,8 +2207,6 @@ def test_setchannel_routing(node_factory, bitcoind): assert route_ok[1]['amount_msat'] == 17 route_bad = copy.deepcopy(route_ok) - route_bad[0]['msatoshi'] = 1337 + 16 - route_bad[1]['msatoshi'] = 16 route_bad[0]['amount_msat'] = Millisatoshi(1337 + 16) route_bad[1]['amount_msat'] = Millisatoshi(16) assert route_bad != route_ok diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 2c6ed0072..d6e1d30c3 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -945,7 +945,7 @@ def test_transaction_annotations(node_factory, bitcoind): assert(len(outputs) == 1 and outputs[0]['status'] == 'confirmed') out = outputs[0] idx = out['output'] - assert(idx in [0, 1] and out['value'] == 10**6) + assert(idx in [0, 1] and out['amount_msat'] == Millisatoshi("{}sat".format(10**6))) # ... and it should have an annotation on the output reading 'deposit' txs = l1.rpc.listtransactions()['transactions']