-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The great msat purge #5306
The great msat purge #5306
Conversation
Yep, that compatibility mode for |
@rustyrussell are there any raw amounts (just |
Yes, schema should be correct! We should add tooling on this (that all outgoing msat fields have names _msat, and all _msat field have msat values) though. |
8037b56
to
f697809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f697809
This example predates the pay plugin! It's obsolete, unmaintained, and probably doesn't work. Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: lightningd: `log-level` `io` shows JSONRPC output, as well as input. Signed-off-by: Rusty Russell <[email protected]>
This is *much* easier to do inside parsing than in the caller! Signed-off-by: Rusty Russell <[email protected]>
We had json_add_amount_msat_only(), which was designed to be used to print out msat fields, if we had sats. However, we misused it, so split it into the three different cases: 1. json_add_amount_sat_msat: We are using it correctly, with a field called xxx_msat. 2. json_add_amount_sats_deprecated: We were using it wrong, so deprecate the old field and create a new one which does end in _msat. 3. json_add_sats: we were using it to hand sats as a JSON parameter to an interface, where "XXXsat". Signed-off-by: Rusty Russell <[email protected]> Changelog-Deprecated: Plugins: `rbf_channel` and `openchannel2` hooks `their_funding` (use `their_funding_msat`) Changelog-Deprecated: Plugins: `openchannel2` hook `dust_limit_satoshis` (use `dust_limit_msat`) Changelog-Deprecated: Plugins: `openchannel` hook `funding_satoshis` (use `funding_msat`) Changelog-Deprecated: Plugins: `openchannel` hook `dust_limit_satoshis` (use `dust_limit_msat`) Changelog-Deprecated: Plugins: `openchannel` hook `channel_reserve_satoshis` (use `channel_reserve_msat`) Changelog-Deprecated: Plugins: `channel_opened` notification `amount` (use `funding_msat`) Changelog-Deprecated: JSON-RPC: `listtransactions` `msat` (use `amount_msat`) Changelog-Deprecated: Plugins: `htlc_accepted` `forward_amount` (use `forward_msat`)
We don't always want to round down, sometimes we want to fail. Signed-off-by: Rusty Russell <[email protected]>
In general, we don't like to use `null` in JSON: simply omit the field. I found this one because it broke our 'msat' parsing (made stricter in followup) which doesn't allow `null`. Signed-off-by: Rusty Russell <[email protected]> Changelog-Deprecated: `listconfigs` `plugins` `options` which are not set are omitted, not `null`.
The new msat fields are turned into Millisatoshi, so handle that correctly too in tests too. Signed-off-by: Rusty Russell <[email protected]> Changelog-Deprecated: Plugins: `coin_movement` notification: `balance`, `credit`, `debit` and `fees` (use `balance_msat`, `credit_msat`, `debit_msat` and `fees_msat`)
This is consistent with our output changes, and increases consistency. It also keeps future sanity checks happy, that we only use JSON msat helpers with '_msat' fields. Signed-off-by: Rusty Russell <[email protected]> Changelog-Changed: JSON-RPC: `invoice`, `sendonion`, `sendpay`, `pay`, `keysend`, `fetchinvoice`, `sendinvoice`: `msatoshi` argument is now called `amount_msat` to match other fields. Changelog-Deprecated: JSON-RPC: `invoice`, `sendonion`, `sendpay`, `pay`, `keysend`, `fetchinvoice`, `sendinvoice` `msatoshi` (use `amount_msat`)
Changelog-Added: Plugins: `htlc_accepted_hook` `amount_msat` field. Changelog-Deprecated: Plugins: `htlc_accepted_hook` `amount` field (use `amount_msat`) Signed-off-by: Rusty Russell <[email protected]>
Nobody really parses this though, fortunately. Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `pay` `attempts` `amount_msat` field. Changelog-Deprecated: JSON-RPC: `pay` `attempts` `amount` field (use `amount_msat`).
The name in the spec is `msat`, but I don't want to make an API exception. Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `fetchinvoice` `changes` `amount_msat` Changelog-Deprecated: JSON-RPC: `fetchinvoice` `changes` `msat` (use `amount_msat`)
Now we've fixed them all, make sure no new ones slip in! Signed-off-by: Rusty Russell <[email protected]>
This prepares for when they start being u64, not strings with msat appended. This has a strange side effect on our schema: despite the name, decodepay's `fee_base_msat` is actually a u64, which we now convert to msat on decode. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
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 <[email protected]>
We should be using amount_msat always. Many tests were not. Plus, deprecating it simplifies the code. Signed-off-by: Rusty Russell <[email protected]> Changelog-Deprecated: JSONRPC: `sendpay` `route` elements `msatoshi` (use `amount_msat`)
…l have "msat" appended. After next patch, it's a raw u64, and this code broke. Signed-off-by: Rusty Russell <[email protected]>
Let the parsing handle if they're the wrong type (soon they'll be u64). Signed-off-by: Rusty Russell <[email protected]>
We would otherwise multiply them by 1000. Signed-off-by: Rusty Russell <[email protected]>
This code was buggy: handing "1000" as a parameter to min_their_funding_msat, don't turn that into "1000sat"! Signed-off-by: Rusty Russell <[email protected]>
We would otherwise multiply them by 1000. Signed-off-by: Rusty Russell <[email protected]>
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 <[email protected]> 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)
Signed-off-by: Rusty Russell <[email protected]>
Since we want to transition to raw `u64` values we need to accept both for some time.
f697809
to
6132e9f
Compare
Trivial rebase to address conflicts, and update examples in PLUGINS.md. Ack 6132e9f |
Ack 6132e9f |
Please do not release a stable version until lightningd/plugins#369 is fixed (here in pyln). Thanks. |
Or rother there in the summary plugin? OK. |
8461e3f fix(rpc): MSat accepts both strings ending with msat and u64 (Riccardo Casatta) Pull request description: According to ElementsProject/lightning#5306 the fields ending with msat will be raw numbers "Code should handle both a "123msat" JSON string and 123 for the transition." I am not 100% sure if it's allowed somewhere to have negative numbers, I thought there aren't based on the `MSat` type on branch master which contains a `u64` Top commit has no ACKs. Tree-SHA512: 734c644a42a30e9985e6da8891912ca6754d924a3a55562e9a670e482aaefe71d89c865160da356944f43e29d829d192b0b91733b5331d9698051c2f159bef2a
@ShahanaFarooqui urged me to complete the msat transition. This series does that, but some msat fields which were not named correctly leaked in, forcing broader deprecations.
"123msat"
JSON string and123
for the transition.