Commit Graph

30 Commits

Author SHA1 Message Date
niftynei 4e503f7d0a bkpr/listpeeers: add lease_fees back to funds; separate out in listpeers
First, how we record "our_funds" and then apply pushes vs lease_fees
(for liquidity ad buys/sales) was exactly opposite.

For pushes we were reporting the total funded into the channel, with the
push representing how much we'd later moved to the peer.

For lease_fees we were rerporting the total in the channel, with the
push representing how much was already moved to the peer.

We fix this (from a view perspective) by re-adding lease fees to what's
reported in the channel funding totals. Since this is now new behavior
(for leased channel values), we added new fields so we can take the old
field names thru a deprecation cycle.

We also make it possible to differentiate btw a push and a lease_fee
(before they were all the same), by adding to new fields to `listpeers`:
`fee_paid_msat` and `fee_rcvd_msat`.

This allows us to avoid math in the bookkeeper, instead we just pick
the numbers out directly and record them.

Fixes #5472

Changelog-Added: JSON-RPC: `listpeers` now has a few new fields for `funding` (`remote_funds_msat`, `local_funds_msat`, `fee_paid_msat`, `fee_rcvd_msat`).
Changelog-Deprecated: JSON-RPC: `listpeers`.`funded` fields `local_msat` and `remote_msat` are now deprecated.
2022-07-31 21:53:05 +09:30
Christian Decker 217ce4c03c schema: Add missing `mindepth` argument to `fundchannel`
This was likely missed during the zeroconf PR.

Changelog-None
2022-07-21 14:19:06 +09:30
Christian Decker b6a4cbbf98 cln-rpc: Add mindepth after rebase on `master` 2022-07-21 14:19:06 +09:30
Christian Decker ca8c46c286 schema: `minconf` should be an integer (u32) not a float (number) 2022-07-21 14:19:06 +09:30
Christian Decker 18a9eb2feb msggen: Add `stop` method to generators
We'll need this when testing the grpc interface in pyln-testing,
otherwise tests just slowly die and wither.
2022-07-21 14:19:06 +09:30
Christian Decker 77f5eb556b msggen: Add fundchannel request 2022-07-21 14:19:06 +09:30
Vincenzo Palazzo e70729b04b rust: upgrade model with new checkmessage requirements
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-07-19 17:55:31 +02:00
Christian Decker 50180e040c msggen: Update generated files to add Listpeers.peers[].remote_addr
Changelog-None
2022-07-15 15:27:45 +09:30
Christian Decker cdedd433a4 jsonrpc: Add aliases to `listpeers` result 2022-07-04 22:14:06 +02:00
Rusty Russell 08d5776ebc lightningd: deprecate `msatoshi` in `sendpay` `route`.
We should be using amount_msat always.  Many tests were not.  Plus,
deprecating it simplifies the code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: JSONRPC: `sendpay` `route` elements `msatoshi` (use `amount_msat`)
2022-06-21 06:52:35 +09:30
Rusty Russell cd7e784d6f lightningd: change `msatoshi` args to `amount_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 <rusty@rustcorp.com.au>
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`)
2022-06-21 06:52:35 +09:30
Rusty Russell 36a2491a89 json: fix up msat amounts in non-_msat fields.
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 <rusty@rustcorp.com.au>
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`)
2022-06-21 06:52:35 +09:30
Rusty Russell c7d359baf4 cln-grpc: API updates after 8dd51d127f
Changing the JSON schemas changes this, and I didn't rebuild!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 10:00:27 +09:30
Rusty Russell f078e54e98 lightningd: remove various deprecated JSON fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: removed `listtransactions` `outputs` `satoshis` field (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` deprecated fields (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` `closer` now omitted, rather than `null` (deprecated v0.10.1)
2022-05-18 10:15:36 +09:30
Christian Decker 9a8bc777e5 msggen: Add pay descriptions and maxfee 2022-04-08 11:30:10 +09:30
Christian Decker aae5e3d070 cln-grpc: Final generation of derived files
Didn't want to pollute each commit with the changes in the derived
files so here are all the changes in one commit :-)
2022-04-02 09:46:01 +10:30
Christian Decker ef145c7900 msggen: Add RoutehintList as a primitive 2022-04-02 09:46:01 +10:30
Christian Decker ec5cd92580 msggen: Add model-side overrides
Sometimes we just want to paper over the schema directly. Mostly
useful to sidestep the `oneof` things that are required for
expressiveness.
2022-04-02 09:46:01 +10:30
Christian Decker bba68e2136 cln-grpc: Map AmountOrAll and AmountOrAny 2022-04-02 09:46:01 +10:30
Christian Decker 04e7e285d7 cln-rpc: Map PSBT and TX methods 2022-04-02 09:46:01 +10:30
Christian Decker 0354a7fdb1 cln-rpc: Add `OutputDesc` for `{addr: amt}` style arguments
This is likely inherited from bitcoind, and a bit awkward for us, so
we parse it into a classic struct, but serialize it back into the
bitcoind format when talking to the RPC.
2022-04-02 09:46:01 +10:30
Christian Decker eb2aa8c51c cln-rpc: Map feerates and backfill methods using it 2022-04-02 09:46:01 +10:30
Christian Decker 20704746bc grpc: Map `sendonion` and `createonion` 2022-04-02 09:46:01 +10:30
Christian Decker a7f3c54600 cln-rpc: Add invoice RPC methods 2022-04-02 09:46:01 +10:30
Christian Decker d90aafeed6 cln-grpc: Add the `connect` method 2022-04-02 09:46:01 +10:30
Christian Decker 6098386182 cln-grpc: Add the `connect` method 2022-03-30 12:15:55 +10:30
Christian Decker 487b5e6169 msggen: Add meta file to keep the field numbers stable
We are inferring the field numbers on the fly, which isn't really
compatible with the way GRPC field numbers work, i.e., they must be
stable while the IDL file evolves. So far when a field was added in
the middle of a struct or removed all subsequent fields would get
renumbered, essentially breaking any client that was using the old
scheme.

We now add a meta file `.msggen.json` that keeps track of the numbers
assigned so far, so they can be reused, and new ones can be generated
not to conflict with existing ones. This file is intentionally kept
generic, so other generators can add more information that has to be
managed across runs.

Changelog-None
2022-03-16 11:11:58 +10:30
Christian Decker 75f0b8e916 cln-grpc: Add `listpeers` RPC method
This is pretty much the hardest to map, but we map it correctly, with
the exception of the state_changes[] array we truncated out in the
last commit.
2022-02-28 23:25:37 +00:00
Christian Decker 24e44ecbb6 cln-grpc: Add glue to get all pieces to work together 2022-02-28 23:25:37 +00:00
Christian Decker d01b2c21a7 cln-grpc: Add generation of grpc protobuf file from schema 2022-02-28 23:25:37 +00:00