JSON: deprecate printing msat fields as strings.

This changes many fields: in non-deprecated mode, they're now raw integers.
This was always the intention, but the transition was never completed.

Suggested-By: @ShahanaFarooqui
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: "_msat" fields can be raw numbers, not "123msat" strings (please handle both!)
Changelog-Deprecated: JSON-RPC: "_msat" fields as "123msat" strings (will be only numbers)
This commit is contained in:
Rusty Russell
2022-06-20 19:52:10 +09:30
parent 5531de99de
commit 60bd70be85
4 changed files with 17 additions and 14 deletions

View File

@@ -626,11 +626,11 @@ def test_openchannel_hook(node_factory, bitcoind):
# Make sure plugin got all the vars we expect
expected = {
'channel_flags': '1',
'dust_limit_msat': '546000msat',
'htlc_minimum_msat': '0msat',
'dust_limit_msat': 546000,
'htlc_minimum_msat': 0,
'id': l1.info['id'],
'max_accepted_htlcs': '483',
'max_htlc_value_in_flight_msat': '18446744073709551615msat',
'max_htlc_value_in_flight_msat': 18446744073709551615,
'to_self_delay': '5',
}
@@ -643,15 +643,15 @@ def test_openchannel_hook(node_factory, bitcoind):
'feerate_our_max': '150000',
'feerate_our_min': '1875',
'locktime': '.*',
'their_funding_msat': '100000000msat',
'channel_max_msat': '16777215000msat',
'their_funding_msat': 100000000,
'channel_max_msat': 16777215000,
})
else:
expected.update({
'channel_reserve_msat': '1000000msat',
'channel_reserve_msat': 1000000,
'feerate_per_kw': '7500',
'funding_msat': '100000000msat',
'push_msat': '0msat',
'funding_msat': 100000000,
'push_msat': 0,
})
l2.daemon.wait_for_log('reject_odd_funding_amounts.py: {} VARS'.format(len(expected)))
@@ -1148,7 +1148,7 @@ def test_htlc_accepted_hook_forward_restart(node_factory, executor):
assert onion['type'] == 'tlv'
assert re.match(r'^11020203e80401..0608................$', onion['payload'])
assert len(onion['shared_secret']) == 64
assert onion['forward_msat'] == '1000msat'
assert onion['forward_msat'] == Millisatoshi(1000)
assert len(onion['next_onion']) == 2 * (1300 + 32 + 33 + 1)
f1.result()