This means that we won't complain to peers which gossip about our
channels, but it does mean that our channel graph (like other nodes on
the network) will show two channels, not one, for the duration.
For this reason, we need askrene to omit local dying channels.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
When paying through a direct channel, direct_pay_override() creates a
route bypassing the normal routing path, which skips the CLTV budget
check in payment_getroute(). This allows payments to succeed even when
maxdelay is set below the required min_final_cltv_expiry.
Add a check in direct_pay_override() to verify the required CLTV
doesn't exceed cltv_budget before using the direct channel shortcut.
If it exceeds, skip the direct channel and let normal routing handle
the failure with a proper error message.
Fixes: #8609
Changelog-Fixed: pay: `maxdelay` parameter now enforced for direct channel payments
Remove anyhow as a dependency from the tlv module. This allows for a
cleaner error handling
Changelog-None
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
The core module shouldn't depend on anything from the cln_adapters
module. This ensures that we can switch out interfaces in the future
(e.g a different database than cln's datastore).
This change made it necessary to refactor the service plugin which
allowed us to clean it up on the go
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Separate concerns of the lsps2 modules into their respective layers:
core for tlv, as it is lightning related, not specifically
core-lightning. cln_adapters for core-lightning related types.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit separates the business logic from core-lighting behaviour
and moves the core-lightning related implementations into the
cln_adapters module.
Splits up tests as well
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This now only makes it easier to test, but also more modular. It allows
us to use any kind of storage, not only the datastore.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
The ClnApi trait is way overloaded. We break things down to make it more
modular on the service side.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
We replace the legacy transport by a slim custommsg hook that makes use
of the lightweight multiplexed transport and avoids deserialization and
serialization through this extra layer
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
We can separate concerns here by adding a lightweight multiplexing
transport client. This helps us to clean up any direct dependencies on
CLN
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit replaces the lsps service. Therefore we add the cln_adapters
module that handles the communication with core-lightning. We add a
lightweight LspsService that wraps the router and allows handlers to
register themselves to the service/router.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This router is very lightweight and can handle routing for the lsps
service. It avoids allocations by just borrowing from the request. This
is much cleaner than what we have now and reduces the amount of
serializations by a lot.
Also it supports typed handlers which will remove serialization overhead
from the handlers in future commits
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
There is no need to communicate via a generic JsonRpcClient if all
messages are well defined and we can use the typed transport to remove a
whole lot of overhead and just pass the ResponseObjects directly to the
Transport layer
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Introducing "request" to the transport trait that uses the RequestObject
and JsonRpcResponse directly reduces some overhead and unnecessary
conversions. Why do we implement a generic transport over &str when we
already know that we are dealing with JSON-RPC 2.0 here.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
There is no need to generate the id in some client when we can actually
generate it on a lower layer as we know by LSPS0 how we have to generate
it.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
As we pass the peer_id through the transport methods, there is no need
to store the peer_id in the Bolt8Transport struct anymore
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Frankly, transport without a target doesn't make sense, so this commit
adds a PublicKey (from secp256k1) as the target to the Transport trait.
It can easily be replaced by a common PeerId without changing the api
for external implementations if needed in the future
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series of commits to make the lsps plugin crate
layered and modular for efficient reuse in external projects.
The core module is responsible for common business logic and interfaces
and acts as the intermediate layer for an actual implementation
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This makes it easier for client implementations to separate transport or
parser related issues from actuall json-rpc error responses. Also this
helps to segregate the individual responsibilities of the crates
further.
This further alows us to remove the error enum from proto/jsonrpc
completely as this now only deals as a from/to-wire module
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
We can use an enum as a more idiomatic rust style to create and retreive
json-rpc responses. The actual response data is kept in the body enum
while the surrounding only holds the identifier.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
In order to create a sane dependecy structure for this crate, this
commit cleans up the jsonrpc error enum and shifts responsibilities
towards the transport client
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Split them up how they are actually defined.
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Those primitives are actually defined in lsps0
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is part of a series that refactor the lsp plugin crate into
a modularized crate with the goal to separate the actual plugin runtime
as much as possible from library code to make it accessible for 3rd
party plugin implementations.
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
describe_scidd() was labeling any channel as "the invoice's route hint"
when there was a single-hop route hint, even if the error occurred on
an unrelated intermediate channel.
Now we check the channel actually matches the route hint's
short_channel_id before using that label.
Fixes: #8252
Changelog-Fixed: xpay: error messages no longer incorrectly label intermediate channels as "the invoice's route hint".
Fixes#6978 where bolt11 annotations were lost when sendonion failed early and payment was retried.
When sendonion RPC fails before saving payment to database, invstring_used flag would remain true, causing retry attempts to omit bolt11 parameter. Successful retries would then save to DB without bolt11 annotation.
Move invstring_used flag setting from payment_createonion_success to payment_sendonion_success. This ensures the flag is only set after sendonion actually succeeds. The bolt11 will be sent with every sendonion attempt until the first successful one, accepting the minor redundancy for cleaner state management.
Changelog-Fixed: Plugins: `listpays` can be missing the bolt11 information in some cases where `pay` is used.
The original method name was lsps-lsps2-invoice but I somehow messed it
up and renamed during a rebase.
Changelog-Changed: lsps-jitchannel is now lsps-lsps2-invoice
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This avoids latency spikes when we ask lightningd to give us 2M entries.
tests/test_coinmoves.py::test_generate_coinmoves (2,000,000, sqlite3):
Time (from start to end of l2 node): 88 seconds (was 95)
Worst latency: 0.028 seconds **WAS 4.5**
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Now we've found all the issues, the latency spike (4 seconds on my laptop)
for querying 2M elements remains.
Restore the limited sampling which we reverted, but make it 10,000 now.
This doesn't help our worst-case latency, because sql still asks for all 2M entries on
first access. We address that next.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>