-
Notifications
You must be signed in to change notification settings - Fork 421
Avoid needless MPP on multiple channels to the same first-hop #1370
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
Avoid needless MPP on multiple channels to the same first-hop #1370
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1370 +/- ##
==========================================
- Coverage 90.75% 90.75% -0.01%
==========================================
Files 73 73
Lines 40884 40906 +22
Branches 40884 40906 +22
==========================================
+ Hits 37106 37123 +17
- Misses 3778 3783 +5
Continue to review full report at Codecov.
|
valentinewallace
left a comment
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.
Makes sense. Tried some random capacities above and below payment amount, seems to work as advertised
| // First, if channels are below `recommended_value_msat`, sort them in descending order, | ||
| // preferring larger channels to avoid splitting the payment into more MPP parts than is | ||
| // required. | ||
| // | ||
| // Second, because simply always sorting in descending order would always use our largest | ||
| // available outbound capacity, needlessly fragmenting our available channel capacities, | ||
| // sort channels above `recommended_value_msat` in ascending order, preferring channels | ||
| // which have enough, but not too much, capacity for the payment. |
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.
Seems like the order of these two paragraphs should be swapped given the conditions are in the opposite order below.
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.
I found it more readable this way, I'll just swap the conditional.
When we have many channels to the same first-hop, many of which do not have sufficient balance to make the requested payment, but when some do, instead of simply using the available channel balance we may switch to MPP, potentially with many, many paths. Instead, we should seek to use the smallest channel which can easily handle the requested payment, which we do here by sorting the first_hops in our router before beginning the graph search. Note that the "real" fix for this should be to instead decide which channel to use at HTLC-send time, as most other nodes do during relay, but this provides a minimal fix without needing to do the rather-large work of refactoring our HTLC send+relay pipelines. Issues with overly-aggressive MPP on many channels were reported by Cash App.
b1bc078
81ecd4d to
b1bc078
Compare
|
Squashed without changes. |
When we have many channels to the same first-hop, many of which do
not have sufficient balance to make the requested payment, but when
some do, instead of simply using the available channel balance we
may switch to MPP, potentially with many, many paths.
Instead, we should seek to use the smallest channel which can
easily handle the requested payment, which we do here by sorting
the first_hops in our router before beginning the graph search.
Note that the "real" fix for this should be to instead decide which
channel to use at HTLC-send time, as most other nodes do during
relay, but this provides a minimal fix without needing to do the
rather-large work of refactoring our HTLC send+relay pipelines.
Issues with overly-aggressive MPP on many channels were reported by
Cash App.