rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Limit payment path length based on `payment_metadata`, custom TLVs, etc.

Open valentinewallace opened this issue 1 year ago • 5 comments

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.

valentinewallace avatar Apr 25 '24 21:04 valentinewallace

Codecov Report

Attention: Patch coverage is 97.88732% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 89.85%. Comparing base (da7a916) to head (3cc673b). Report is 4 commits behind head on main.

Files Patch % Lines
lightning/src/routing/router.rs 77.14% 8 Missing :warning:
lightning/src/ln/max_payment_path_len_tests.rs 99.22% 2 Missing :warning:
lightning/src/ln/outbound_payment.rs 91.66% 1 Missing and 1 partial :warning:

:exclamation: 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.85%   +0.06%     
==========================================
  Files         116      117       +1     
  Lines       96466    97278     +812     
  Branches    96466    97278     +812     
==========================================
+ Hits        86619    87413     +794     
- Misses       7290     7314      +24     
+ Partials     2557     2551       -6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 25 '24 23:04 codecov-commenter

I found some more edge cases around how get_route counts hops as part of a path, so feel free to hold off on review there.

valentinewallace avatar Apr 29 '24 19:04 valentinewallace

Rebased to (hopefully) fix CI. This should be good for review.

valentinewallace avatar Apr 30 '24 19:04 valentinewallace

Feedback should be addressed. Also this needs a rebase so let me know when I can do that.

valentinewallace avatar May 13 '24 23:05 valentinewallace

Squashed with 1 new fixup.

valentinewallace avatar May 16 '24 22:05 valentinewallace

Squashed.

valentinewallace avatar May 20 '24 23:05 valentinewallace