Commit Graph

169 Commits

Author SHA1 Message Date
Christian Decker 5924509813 rpc: Regenerate derived files after adding bkpr-listincome 2024-02-01 20:00:52 +01:00
Rusty Russell dd59d0617d lightningd: expose last_stable_connection in RPC.
This isuseful to find completely dead channels which are worthy of
closing.

Changelog-Added: JSON-RPC: `listpeerchannels` field `last_stable_connection` showing when we last held an established channel for a minute or more.
Changelog-Added: JSON-RPC: `listclosedchannels` field `last_stable_connection` showing when we last held an established channel for a minute or more.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-31 14:47:33 +10:30
Rusty Russell 17d0d006d2 fundchannel_start & multifundchannel: add channel_type.
Let's tell the caller what channel_type they got!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `fundchannel`, `multifundchannel`, `fundchannel_start` and `openchannel_init`: new field `channel_type`.
2024-01-29 13:40:34 +10:30
Rusty Russell 3c2a57598f spenderp: add channel_type parameter to fundchannel / multifundchannel.
And add a request schema for multifundchannel.

Changelog-Added: JSON-RPC: `fundchannel` and `multifundchannel` now take an optional `channel_type` parameter.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-29 13:40:34 +10:30
Christian Decker 45b298fca4 msggen: Make `ChannelTypeName` a native enum
It fails because this is an array of enum values, which is a
combination we hadn't seen before. Replacing this with a manually
managed enum, since it is likely we'll want to reuse it in the future.
2024-01-29 13:40:34 +10:30
Rusty Russell f342630b92 wallet: remove P2SH support.
Seriously, it's taproot time, let's get rid of p2sh wrapped segwit.

Changelog-Removed: wallet: removal of p2sh-segwit addresses; newaddr won't issue them, we won't watch them for new funds (deprecated in *23.02*)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-01-26 10:30:22 +10:30
Erik De Smedt 000fceb215 Rust cln-rpc crate: Fix `call_enum` and `call`
I've broken the error-handling for `call` in a previous commit.
The key problem is that it failed to parse Json-RPC error's
that were returned by the server. It always returned a parse-
error instead.

To fix it I've adapted `call_raw_request`.
In the previous implementation local errors (e.g: Failing to find the
socket-file) where returned in a Result::Err. However, when the
rpc-server returned an error the data was encoded in the Result::Ok.

In this commit every error is returned as a `Result::Err` and
various methods and other calls have been edited to match this behavior.

I've also added additonal testing
2024-01-09 14:12:46 +01:00
Erik De Smedt dba977dfa2 Some basic documentation for `cln_rpc` 2024-01-09 14:12:46 +01:00
Erik De Smedt 4b5dade87f cln_rpc : use `call_typed` with external structs
One limitation of the `call_typed`-method was that it could not be used
with types defined outside of this crate. (See dependency on
`IntoRequest`)

This is useful for types that are not (yet) defined in this crate. A
possible case is an rpc-method that is defined in a plug-in that is
external to core-lightning or any method which isn't yet a part of the
`msggen`-script.

I've implemented a `TypedRequest` trait to make it work.

PS: This change is breaking. Users of `call_typed` must import
`cln_rpc::models::TypedRequest` instead of
`cln_rpc::models::IntoRequest`
2024-01-09 14:12:46 +01:00
Erik De Smedt ce41aa4ccc cln_rpc: Split low- from high-level API calls.
The `cln::ClnRpc` plugin has a `call` and a `call`-typed method
which worked only on structs that are mentioned in
`src::primitives::Request`.

The consequence is that any rpc-method that is not (yet) defined in this
crate could not be used.

I've adapted the `ClnRpc`-method and create a low-level binding named
`call_raw`. All changes in this commit should be backward compatible.
2024-01-09 14:12:46 +01:00
daywalker90 56d42ea767 rust: use "map_or" instead of "if let"
Co-authored-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-12-16 12:11:14 +01:00
Christian Decker 05105d404c rs: Bump versions of `cln-plugin` and `cln-rpc` 2023-12-15 10:01:57 +10:30
Rusty Russell c3f33eb6dd listpeerchannels: show gossip updates.
This is redundant if it's a public channel, but vital if it's not.  Publishing unconditionally makes
it easier for gossmap: we create a local modification all the time, even if redundant (and we can
have the actual capacity ceiling accurate in this case, since we know it for local channels).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Changelog-Added: JSON-RPC: `listpeerchannels` now shows gossip update contents (even if channel unannounced).
2023-12-14 09:16:56 +10:30
Christian Decker 94f4d75006 msggen: Add `Wait` method to managed API
Fixes #6792

Changelog-Added: Cln-RPC: Add `wait` system to cln-rpc and cln-grpc.
2023-11-16 09:02:33 +01:00
Christian Decker bdfd2d5fda msggen: Add `FetchInvoice` method to Rust and grpc bindings
Closes #6844

Changelog-Added: Cln-RPC: Add `fetchinvoice` method to cln-rpc and cln-grpc.
2023-11-16 09:02:33 +01:00
niftynei ecb8d9d71f dual-fund: add new open-commit-ready state
From the spec:

	Once peers are ready to exchange commitment signatures, they must remember
	the details of the funding transaction to allow resuming the signatures
	exchange if a disconnection happens.

Basically this means we add channels to the database before we've gotten
commitments for them; it's nice that there's now a state for commitments
recevied but we now save the channel prior to that.

This commit makes it possible to track the pre-commit-rcvd but not quite
open-init state.
2023-11-02 19:32:05 +10:30
daywalker90 39b7d6fa4d add data field to RpcError 2023-11-01 17:28:50 +01:00
Chris Guida dfa326ed9f cln-rpc: Update the Makefile to always rebuild each example when the example files themselves are changed
and to rebuild all the examples when the dependencies are changed (`CLN_RPC_SOURCES`).
2023-10-30 18:24:23 +01:00
Chris Guida c6262189b7 cln-plugin: Add test for cln-plugin send_custom_notification
Also fix Makefile for rust plugin examples

Also add in a missing assert in the test_plugin_start test
2023-10-30 18:24:23 +01:00
Rusty Russell f2162bf202 lightningd: add ordering and pagination to listforwards.
Changelog-Added: JSON-RPC: `listforwards` new parameters `index`, `start` and `limit`.
2023-10-28 15:48:26 +10:30
Rusty Russell 1d8af90b56 listforwards: add created_index and updated_index fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listforwards` fields `created_index` (old: `id`) and `updated_index`.
2023-10-28 15:48:26 +10:30
Rusty Russell c70a326f1f lightningd: add ordering and pagination to listsendpays.
Changelog-Added: JSON-RPC: `listsendpays` new parameters `index`, `start` and `limit`.
2023-10-28 15:48:26 +10:30
Rusty Russell 00ac1a9475 listsendpays: add created_index and updated_index fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `sendpay`, `listsendpays`, `delpay` new fields `created_index` (old: `id`) and `updated_index`.
2023-10-28 15:48:26 +10:30
Aditya Sharma b0c603581f doc/lightning-decode.7: Update the doc 2023-10-27 16:05:28 +10:30
Chris Guida 88ac2dcb7e add test, update schemas, fix warning_custom_fallbacks 2023-10-26 19:11:17 +10:30
niftynei 411bb2884a fallback: json add fallback cleanup
Expand to handle P2TR addresses, use the common script encoding utility
function instead of reimplementing it.
2023-10-26 19:11:17 +10:30
Peter Neuroth 510984b366 rpc: Add datastoreusage command
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
2023-10-26 12:58:04 +10:30
daywalker90 eda6a4b44a switch from ToString to Display for ShortChannelId 2023-10-24 11:35:14 +02:00
Christian Decker dfea5fbe6d grpc: Add WaitBlockHeight method to grpc interface 2023-10-24 10:24:52 +10:30
Christian Decker 76c5e6aa65 rs: Implement a best-effort msat to sat conversion
Some methods (`withdraw`) require their parameter to be in satoshis
rather than millisats. In order for us not to have to come up with yet
another triple of sat, sat_or_all, and sat_or_any, we just bolt it
onto the conversion.
2023-10-24 10:24:52 +10:30
Christian Decker 535d3d953d rs: Bump crates cln-rpc and cln-grpc to 0.1.5 and cln-plugin to 0.1.6 2023-10-24 10:24:52 +10:30
Rusty Russell 5b9b056853 doc: introduce new state DUALOPEND_OPEN_COMMITTED.
This is the variant of DUALOPEND_OPEN_INIT which you see once
the channel is in the db: we'll be adding it next, but to reduce
clutter the docs are added as a separate commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
daywalker90 10eeceabd5 add CHANNELD_AWAITING_SPLICE state to cln-rpc 2023-09-21 18:53:51 +02:00
daywalker90 451fb77e5b add Eq, PartialOrd, Ord, Hash to ShortChannelId 2023-09-11 18:24:51 +02:00
Christian Decker 990096f904 schema: Fix wrong type of CLTV in route
We were using `number` instead of `u32` which caused it to be
serialized to string with a decimal, which then would be rejected by
lightningd.

Changelog-Fixed: proto: Fixed a wrong number type being used in routes
2023-09-01 07:32:14 +09:30
Christian Decker 8e2e7b1c51 rs: Bump crate versions before publishing
Changelog-None
2023-08-28 11:19:30 +02:00
Christian Decker 9074341ef6 msggen: Add `staticbackup` call to list of managed methods
Changelog-Added: cln-grpc: Added `staticbackup` support to cln-grpc
2023-08-06 12:34:36 +09:30
Dusty Daemon 4628e3ace8 channeld: Code to implement splicing
Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
2023-07-31 21:00:22 +09:30
Christian Decker 7b8ea7f60a msggen: Add two missing fields to the `listpays` schema
The fields were missing because they weren't annotated with a type and
a description. Adding those fixes them.

Changelog-Fixed: msggen: `listpays` now includes the missing `amount_msat` and `amount_sent_msat` fields
No-schema-diff-check: fields were always there, just undocumented!
2023-07-27 12:40:28 +09:30
ff 6920e36135 added listhtlcs model 2023-07-24 09:07:24 +09:30
Rusty Russell d25a8ca0fd lightningd: expose created_index and updated_index fields.
If you miss a wait event, you can catch up by doing listinvoices and
getting the max of these fields.  It's also a good debugging clue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-23 13:48:37 +09:30
Rusty Russell 284262d006 listinvoices: add limit param.
Changelog-Added: JSON-RPC: `listinvoices` has `limit` parameter for listing control.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-23 13:48:37 +09:30
Rusty Russell 16c133746b listinvoices: add index and start params.
Now we have defined ordering, we can add a start param.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listinvoices` has `index` and `start` parameters for listing control.
2023-07-23 13:48:37 +09:30
Ilya Evdokimov fe15f66146 parital eq for channel state enum 2023-07-22 13:55:36 +09:30
Rusty Russell b529e79621 lightningd: `setchannel` can set `ignorefeelimits`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `setchannel` adds a new `ignorefeelimits` parameter to allow peer to set arbitrary commitment transaction fees on a per-channel basis.
2023-07-22 13:11:08 +09:30
Rusty Russell 8910529e6a lightningd: expose ignore_fee_limits field in listpeerchannels.
Changelog-Added: JSON-RPC: `listpeerchannels` has a new field `ignore_fee_limits`
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 13:11:08 +09:30
Greg Sanders 4b70736d13 Support p2tr deposit addresses
Changelog-Added: JSON-RPC: newaddr: p2tr option to create taproot addresses.
Changelog-Changed: Wallet: we now use taproot change addresses.
2023-07-11 11:41:15 +09:30
Christian Decker 557cd183ac cln-rpc: Generate ToString for Enums
This will return the stringified name of the variant.
2023-07-10 18:22:11 +02:00
Christian Decker 32f9d78096 msggen: Derive `Eq` on generated Enums as well 2023-07-10 18:22:11 +02:00
Paul Miller a298f00229 rs: derive PartialEq for simple rust enums 2023-07-10 18:22:11 +02:00