Commit graph

7318 commits

Author SHA1 Message Date
Valentine Wallace
abb53d192d
Remove now-unused NetworkUpdate::ChannelUpdateMessage.
See previous commit.
2024-05-28 17:54:26 -04:00
Jeffrey Czyz
e4661fe4c4
Add missing copyright statement 2024-05-28 16:35:56 -05:00
Jeffrey Czyz
e8354b212b
Compact introduction node test vector 2024-05-28 16:35:56 -05:00
Jeffrey Czyz
0a6886ee38
Compact a BlindedPath's introduction node
Add a method to BlindedPath that given a network graph will compact the
IntroductionNode as the DirectedShortChannelId variant. Call this method
from DefaultMessageRouter so that Offer paths use the compact
representation (along with reply paths). This leaves payment paths in
Bolt12Invoice using the NodeId variant, as the compact representation
isn't as useful there.
2024-05-28 16:35:56 -05:00
Jeffrey Czyz
4956ade170
Unwrap reply_path in extract_invoice_request 2024-05-28 16:35:55 -05:00
Jeffrey Czyz
e553a71b6f
Pass ForwardNode when creating BlindedPath
Instead of passing Vec<PublicKey> to MessageRouter::crate_blinded_path,
pass Vec<ForwardNode>. This way callers can include a short_channel_id
for a more compact BlindedPath encoding.
2024-05-28 16:35:55 -05:00
Jeffrey Czyz
d792afb08c
Support NextHop::ShortChannelId in BlindedPath
When sending an onion message to a blinded path, the short channel id
between hops isn't need in each hop's encrypted_payload since it is not
a payment. However, using the short channel id instead of the node id
gives a more compact representation. Update BlindedPath::new_for_message
to allow for this.
2024-05-28 16:35:41 -05:00
valentinewallace
2c71923a5a
Merge pull request #3006 from arik-so/arik/trampoline/2024-04-trampoline-onion-deserialization
Trampoline Onion Deserialization
2024-05-28 16:55:17 -04:00
Valentine Wallace
85db25b16d
Fix import order in gossip.rs.
A new import will be added in the next commit.
2024-05-28 16:40:39 -04:00
Matt Corallo
5d9f3b4fc2
Merge pull request #3051 from TheBlueMatt/2024-04-2982-123-fix
Don't attempt to resume channels if we already exchanged funding
2024-05-28 10:47:23 -07:00
Matt Corallo
53cd31a2ec Don't attempt to resume channels if we already exchanged funding
ddf75afd16 introduced the ability to re-exchange our `ChannelOpen`
after a peer disconnects if we didn't complete funding on our end.
It did not implement nor consider what would happen if we
re-connected after we created our own funding transactions, and
currently it panics (and even if it did not it would replay the
`FundingTransactionGenerated` event to users).

While we'd very much like to replay the `open_channel` flow even
if we have already received an `accept_channel` and funded the
channel, we cannot as the peer will likely provide different key
material in their `accept_channel`, causing us to need a different
funding transaction.

Thus, here, we simply close channels which have been funded but not
yet signed when our peer disconnects.
2024-05-28 15:34:46 +00:00
Matt Corallo
c1ea761e70 f docs 2024-05-28 15:22:00 +00:00
Jeffrey Czyz
8499214bcc
Check custom_tlvs in Event::PaymentClaimed 2024-05-24 16:52:08 -05:00
Jeffrey Czyz
ac15105162
Pass ClaimAlongRouteArgs to claim_payment_along_route 2024-05-24 16:52:08 -05:00
Jeffrey Czyz
b6ff46daab
Pass ClaimAlongRouteArgs to do_claim_payment_along_route 2024-05-24 16:52:08 -05:00
Jeffrey Czyz
b745047fe4
Include RecipientOnionFields in PaymentClaimed
RecipientOnionFields are included in Event::PaymentClaimable, so
naturally they should be included in Event::PaymentClaimed, too.
2024-05-24 16:51:09 -05:00
Jeffrey Czyz
a4a34f9ae9
Add RecipientOnionFields to ClaimingPayment
This will be used to include the same field in Event::PaymentClaimed.
2024-05-24 11:44:11 -05:00
Jeffrey Czyz
3ab45d82d1
Use HashMap::entry instead of HashMap::insert
This allows for obtaining the value without needing to re-look it up. An
upcoming commit will include RecipientOnionFields in the inserted value.
Having it available afterwards prevents needing to clone it.
2024-05-24 11:31:30 -05:00
Jeffrey Czyz
101af71515
Format HashMap::insert call 2024-05-24 11:30:55 -05:00
Valentine Wallace
24c2468d0a
Ignore channel updates in onion errors.
Per <https://github.com/lightning/bolts/pull/1163>.
2024-05-24 12:15:26 -04:00
Elias Rohrer
1d421d3362
Merge pull request #3079 from jkczyz/2024-05-expects-quantity
Add missing `Offer::expects_quantity` to tests
2024-05-23 13:01:06 +02:00
Jeffrey Czyz
7ceb709530
Add missing Offer::expects_quantity to tests 2024-05-22 14:20:43 -05:00
valentinewallace
a95338a8f6
Merge pull request #3038 from TheBlueMatt/2024-05-no-dir-with-on-side-offline
Ignore partially-pruned channels during routing
2024-05-21 11:05:30 -04:00
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
Elias Rohrer
1d452d061a
Merge pull request #3069 from TheBlueMatt/2024-06-log-chan-count
Log how many nodes/channels we have synced when we try to route
2024-05-20 14:13:18 +02: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
valentinewallace
da7a916682
Merge pull request #3061 from TheBlueMatt/2024-05-bindings-upstream
Minor bindings tweaks
2024-05-14 09:44:25 -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