Commit graph

4910 commits

Author SHA1 Message Date
Matt Corallo
37bf61c49b
Merge pull request #3026 from valentinewallace/2024-04-limit-path-len
Limit payment path length based on `payment_metadata`, custom TLVs, etc.
2024-05-21 07:19:37 -07:00
Matt Corallo
511d7e3f5f
Merge pull request #3073 from tnull/2024-05-bump-nits
Fix minor nits in `BumpTransactionEventHandler`
2024-05-21 06:08:35 -07:00
Elias Rohrer
c84c2b6030
Merge pull request #3068 from toxeus/main
Re-export bitcoin crate
2024-05-21 12:18:53 +02:00
Arik Sosman
98a926f07d
Test Trampoline onion (de)serialization round trip. 2024-05-20 17:32:21 -07:00
Arik Sosman
c9fb4a3760
Make Trampoline onion deserializable. 2024-05-20 17:32:21 -07:00
Valentine Wallace
3cc673bec2
Add public util on RouteParameters for setting max path length. 2024-05-20 18:57:18 -04:00
Valentine Wallace
c07245f129
Test routing payment parameters' max path length setting and usage. 2024-05-20 18:57:18 -04:00
Valentine Wallace
f0b5c58201
outbound_payment: set max path length in PaymentParameters.
So the router knows how long the maximum payment path can be.
2024-05-20 18:57:13 -04:00
Valentine Wallace
c6de5e192d
Test utils: include payment_metadata in PassAlongPathArgs. 2024-05-20 18:57:13 -04:00
Valentine Wallace
baa727ea38
Abide by max path length param in router.
Also adds some testing by augmenting existing tests.
2024-05-20 18:57:10 -04:00
Valentine Wallace
7f7f375240
Add max path length knob to PaymentParameters.
Will be used so the outbound_payment module can calculate the maximum path
length with knowledge of any custom TLVs or payment metadata present.
2024-05-20 18:57:07 -04:00
Matt Corallo
7f16039d4a Log how many nodes/channels we have synced when we try to route
A common issue in LN is not having fully synced the network graph
when we attempt to send a payment. This should be improved
substantially with gossip v1.5, but for now we should improve our
debugability by logging how many nodes we have in our graph when
we attempt to find a route.
2024-05-19 18:36:50 +00:00
Filip Gospodinov
9cbb4e2928 Re-export bitcoin crate
For the same reason the `bitcoin` crate is re-exporting
the `secp256k1` crate the `lightning` crate should
re-export the `bitcoin` crate: to ease the burden on
calling code to maintain compatible `bitcoin` versions.

The `lightning` crate makes heavy use of types defined in
(or re-exported by) the `bitcoin` crate. Compilation will
fail if e.g. comparisons or `match` expressions are done with
types from `bitcoin` crate versions with a non-equal minor
version. This forces calling code to depend on a `bitcoin`
crate with a compatible version. This becomes a maintenance
nightmare once two or more crates, that use `bitcoin` types
in their public API, are used in calling code simultaneously.
2024-05-17 17:00:44 +02:00
Elias Rohrer
8e08eafb4d
Fix minor nits in BumpTransactionEventHandler 2024-05-17 09:07:33 +02:00
Valentine Wallace
bcdb67e560
Extract onion_utils::build_onion_payloads_callback helper.
Will be useful when we want to calculate the total size of the payloads without
actually allocating for them.
2024-05-16 15:08:44 -07:00
valentinewallace
1237abffa7
Merge pull request #3036 from TheBlueMatt/2024-05-filter-color
Provide more color in filter registration methods
2024-05-14 16:23:30 -07:00
Valentine Wallace
2de600b984
Make MAX_PATH_LENGTH_ESTIMATE const pub and expand doc comment.
Will be used in the next commit when we make this configurable in
PaymentParameters.
2024-05-14 09:57:51 -07:00
Valentine Wallace
336c77c738
TestRouter: support checking only that route params are as expected. 2024-05-14 09:57:51 -07:00
Valentine Wallace
960dd658db
Remove unnecessary RecipientOnionFields clone.
Doable now that we take Vecs by reference in OutboundOnionPayload.
2024-05-14 09:57:51 -07:00
Valentine Wallace
e4e6e09b67
OutboundOnionPayload: hold Vec fields as references.
Will be useful when we reuse this enum to calculate the maximum path length,
to avoid cloning the vecs.
2024-05-14 09:57:51 -07:00
Matt Corallo
e1d00063e2 Allow any Deref to an EntropySource in BlindedPath building
This matches our normal API semantics and allows, for example,
`Arc`s to `EntropySource`s.
2024-05-14 13:17:03 +00:00
Matt Corallo
bccddcaabd impl Clone on various public (mostly BOLT12) types
This is required for bindings as passing types from Rust to GC'd
languages can't map the concept of a type that has a lifetime of
the called function but instead needs to clone for safety.
2024-05-14 13:17:03 +00:00
Matt Corallo
7e69d835b2 Expose ChannelManager offer constructors in bindings 2024-05-13 18:55:22 +00:00
Matt Corallo
3da85c94ff Mark io_extras as no-bindings-export as its not for public use 2024-05-13 18:55:22 +00:00
Matt Corallo
6bc2a573bb Make offers::Amount Copy and export it in bindings
`Amount` is less than two pointers long, so there's no reason it
shouldn't be `Copy`. Further, because its an enum, bindings can't
map a reference to it in an `Option`. Thus, here, we simply make it
`Copy` and return it in `Option`s rather than a reference to it.
2024-05-13 18:55:22 +00:00
Matt Corallo
5c21ee98a8 Use prelude by universal import, rather than single import
This avoids the bindings trying to figure out what a
`lightning::prelude::Vec` is rather than matching it as a `Vec`.
2024-05-13 18:55:22 +00:00
Matt Corallo
58febc36d1 Export ChannelId in bindings rather than [u8; 32]
Now that `ChannelId` has useful constructors and methods we need
to start exposing it to bindings users rather than relying on using
`[u8; 32]`.
2024-05-13 18:55:22 +00:00
Matt Corallo
3fc3166b28 Skip BestBlock::new in bindings as we already have one 2024-05-13 18:55:22 +00:00
Matt Corallo
1890e8049b
Merge pull request #3058 from benthecarman/deref-empty-nod-id-lookup
impl Deref for EmptyNodeIdLookUp
2024-05-13 06:09:31 -07:00
Jeffrey Czyz
efc75794f4
Remove WriteableEcdsaChannelSigner trait
WriteableEcdsaChannelSigner is no longer needed now that
EcdsaChannelSigner isn't written in OnchainTxHandler.
2024-05-10 17:17:41 -05:00
Jeffrey Czyz
ae98eccfa9
Stop writing EcdsaChannelSigner
EcdsaChannelSigner is no longer deserialized as of version 0.0.113 and
downgrades before version 0.0.113 are no longer supported as of version
0.0.119.
2024-05-10 17:17:34 -05:00
Matt Corallo
98022e6d6d Add a utility to poll multiple futures simultaneously
If we have a handful of futures we want to make progress on
simultaneously we need some way to poll all of them in series,
which we add here in the form of `MultiFuturePoller`. Its probably
not as effecient as some of the options in the `futures` crate, but
it is very trivial and not that bad.
2024-05-10 21:29:53 +00:00
Matt Corallo
20f2dab5c0 Create an AOnionMessenger trait similar to our other AStructs
This allows us to have a bound on any `OnionMessenger` without
having to create bounds for every bound in `OnionMessenger`.
2024-05-10 21:29:50 +00:00
Matt Corallo
0ffa4b3579
Merge pull request #2930 from jbesraa/Add-PaymentHash-to-Record
Add `PaymentHash` to `Record`
2024-05-10 09:55:55 -07:00
Arik
8f1dc54e6d
Merge pull request #2973 from valentinewallace/2024-03-om-mailbox
Support intercepting onion messages for offline peers
2024-05-09 15:27:49 -07:00
benthecarman
bfff6fda6e
impl Deref for EmptyNodeIdLookUp 2024-05-09 15:58:19 -05:00
Valentine Wallace
a5ada64866
Fill in top-level docs for onion message offline peer interception. 2024-05-09 15:29:48 -04:00
Valentine Wallace
edc86e319f
Limit OnionMessenger event buffer size. 2024-05-09 15:29:44 -04:00
Valentine Wallace
6613f1f0d2
Manually implement Debug for onion message packets.
Previously we derived Debug, but that caused a lot of unreadable encrypted
bytes to be printed.
2024-05-09 15:29:44 -04:00
Valentine Wallace
be31e632c2
Test offline peer onion message interception. 2024-05-09 15:29:41 -04:00
Valentine Wallace
4c7ecaaa3f
Fix outdated comment in onion message functional test. 2024-05-09 15:29:41 -04:00
Valentine Wallace
1fc8f115af
Refactor MessengerNode test util construction to take config.
Will be used in the next commit when another config parameter is added.
2024-05-09 15:29:41 -04:00
Valentine Wallace
7213458b82
Support forwarding prebuilt onion messages in OnionMessenger. 2024-05-09 15:29:38 -04:00
Valentine Wallace
1c28cc0713
OnionMessenger: support generating peer connection events.
Useful if we are in the mode of interception OMs for offline peers, so
users know when to re-inject intercepted OMs.
2024-05-09 15:29:34 -04:00
Valentine Wallace
e8f7fe1919
Support generating events when an OM for an offline peer is received.
Docs will be added in upcoming commits.
2024-05-09 15:29:29 -04:00
Matt Corallo
33b9ba558c
Merge pull request #3041 from G8XSU/followup-2957
Followups to #2957
2024-05-09 09:47:41 -07:00
Matt Corallo
4fd8cb8909 Ignore partially-pruned channels during routing
If we prune one side of a channel's `ChannelUpdateInfo` that means
the node hasn't been online for two weeks (as they haven't
generated a new `channel_update` in that time). In such cases, even
if we haven't yet pruned the channel entirely, we should definitely
not be treating these channels as candidates for routing.

Note that this requires some additional `channel_update`s in the
router tests, but all of the new ones are added as disabled
channels.

Fixes #1824
2024-05-09 15:27:42 +00:00
jbesraa
fe7f548ebb
Add payment_hash to WithChannelMonitor 2024-05-09 11:59:39 +03:00
esraa
3fb329b004
Add PaymentHash to Record
Adding the `payment_hash` to `Record` so we are able to track it
    in logs.
2024-05-09 11:57:53 +03:00
Jeffrey Czyz
38690bf50a
Merge pull request #2907 from shaavan/issue2882
Introduce ResponseInstructions for OnionMessage Handling
2024-05-08 17:32:41 -05:00