-
Notifications
You must be signed in to change notification settings - Fork 435
router: Use aggregate capacity for first-hop fragmentation check #4331
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
base: main
Are you sure you want to change the base?
router: Use aggregate capacity for first-hop fragmentation check #4331
Conversation
|
👋 Hi! This PR is now in draft status. |
The routing fragmentation mitigation heuristic requires each channel to contribute at least `payment_amount / max_path_count` to avoid excessive path splitting. This makes sense for network paths where each additional path incurs base fees and increases failure probability. However, for first hops this is overly restrictive. Multiple channels to the same peer converge immediately at the first hop - there's no actual network-level fragmentation. A 2M sat channel and a 48M sat channel to the same peer should be usable together for a 50M sat payment, but currently the small channel gets rejected (threshold would be 5M sat with default max_path_count=10), leaving only 48M available. This change checks the aggregate capacity across all first-hop channels to a peer. If the aggregate meets the contribution threshold, individual channels are allowed regardless of their size.
0aa525f to
6c8ab68
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4331 +/- ##
==========================================
- Coverage 86.53% 85.84% -0.70%
==========================================
Files 158 156 -2
Lines 103188 102869 -319
Branches 103188 102869 -319
==========================================
- Hits 89292 88303 -989
- Misses 11471 12000 +529
- Partials 2425 2566 +141
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TheBlueMatt
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.
Oops sorry I missed this. The comments/description is wrong (there's definitely still fragmentation!) but it seems reasonable to accept it in first-hop cases to ensure we can send our full balance.
I wonder, however, if we shouldn't only do this in cases where we need it - cases where there is no channel to a peer above the amount we're sending.
| // Verify the liquidity offered by this channel complies to the minimal contribution. | ||
| let contributes_sufficient_value = value_contribution_msat >= minimal_value_contribution_msat; | ||
| // For first hops, we allow skipping this if their aggregate capacity meets the | ||
| // threshold (they converge immediately, so no real fragmentation occurs). |
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 isn't true, though. HTLCs aren't merged and there's still fragmentation across separate paths.
The routing fragmentation mitigation heuristic requires each channel to contribute at least
payment_amount / max_path_countto avoid excessive path splitting. This makes sense for network paths where each additional path incurs base fees and increases failure probability.However, for first hops this is overly restrictive. Multiple channels to the same peer converge immediately at the first hop - there's no actual network-level fragmentation. A 2M sat channel and a 48M sat channel to the same peer should be usable together for a 50M sat payment, but currently the small channel gets rejected (threshold would be 5M sat with default max_path_count=10), leaving only 48M available.
This change checks the aggregate capacity across all first-hop channels to a peer. If the aggregate meets the contribution threshold, individual channels are allowed regardless of their size.