New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit payment path length based on payment_metadata
, custom TLVs, etc.
#3026
base: main
Are you sure you want to change the base?
Limit payment path length based on payment_metadata
, custom TLVs, etc.
#3026
Conversation
lightning/src/ln/outbound_payment.rs
Outdated
|
||
let num_reserved_bytes = match &route_params.payment_params.payee { | ||
Payee::Blinded { route_hints, .. } => { | ||
let largest_path = route_hints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: currently I’m evaluating the max path length based on the largest blinded path, i.e. the blinded path that limits us the most. Therefore, if some blinded paths are larger than others, this could unnecessarily limit us in pathfinding. We could set the max path length on a per-blinded-path basis? In practice, ISTM that blinded paths within the same invoice are likely to be of similar sizes to each other.
3f0da18
to
52bb5d2
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3026 +/- ##
==========================================
+ Coverage 89.79% 89.83% +0.03%
==========================================
Files 116 117 +1
Lines 96466 96909 +443
Branches 96466 96909 +443
==========================================
+ Hits 86619 87055 +436
- Misses 7290 7301 +11
+ Partials 2557 2553 -4 ☔ View full report in Codecov by Sentry. |
52bb5d2
to
1af8a0c
Compare
I found some more edge cases around how |
8ef1770
to
c8fbb96
Compare
Rebased to (hopefully) fix CI. This should be good for review. |
7ee7c37
to
8de126d
Compare
Feedback should be addressed. Also this needs a rebase so let me know when I can do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to squash, IMO.
lightning/src/ln/onion_utils.rs
Outdated
node_features: NodeFeatures::empty(), | ||
short_channel_id: 42, | ||
channel_features: ChannelFeatures::empty(), | ||
fee_msat: route_params.final_value_msat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be higher if we have to overpay when routing, so the object could serialize a bit longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some buffer here. I think my buffer is a bit conservative so let me know if it needs tuning.
Will be useful when we reuse this enum to calculate the maximum path length, to avoid cloning the vecs.
Doable now that we take Vecs by reference in OutboundOnionPayload.
Will be used in the next commit when we make this configurable in PaymentParameters.
Will be useful when we want to calculate the total size of the payloads without actually allocating for them.
Will be used so the outbound_payment module can calculate the maximum path length with knowledge of any custom TLVs or payment metadata present.
Also adds some testing by augmenting existing tests.
So the router knows how long the maximum payment path can be.
8de126d
to
6255996
Compare
Currently the maximum payment path length is hardcoded in the router to 19. However, the presence of
payment_metadata
, custom TLVs, and/or blinded paths may mean that the actual limit is much shorter. Account for these extra onion fields when calculating and setting the maximum path length for use in pathfinding.Closes #2201.