Repository navigation
askrene: skip redundant small-channel layer for single-path routing - #9750
Open
decodekush wants to merge 1 commit into
Open
decodekush wants to merge 1 commit into
decodekush wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
When maxparts == 1, do_getroutes() previously built and applied the temporary layer auto.remove_small_channels, adding disabling updates for every channel whose capacity was below the payment amount. On a typical network graph with tens of thousands of channels, applying this layer triggered an O(N^2) scan in gossmap_local_updatechan() via find_localmod(), blocking askrene's main event loop for seconds to tens of seconds before the search even began. The single-path Dijkstra solver (init_linear_network_single_path) already excludes channels with insufficient capacity during graph initialization in O(1) time per channel. The small-channel layer was an artifact of the original MCF solver (ElementsProject#8059) before the single-path solver existed (ElementsProject#8299). Remove remove_small_channel_layer and avoid constructing this layer. Also update test_getroutes_single_path failure assertions now that askrene accurately reports capacity shortfall rather than an artificial layer disablement, and add a regression test verifying sub-second getroutes setup with maxparts=1 on real gossip data. Fixes: ElementsProject#9739 Changelog-Fixed: askrene: eliminate quadratic setup lag on single-path getroutes calls Signed-off-by: decodekush <kushagraagarwal1612@gmail.com>
decodekush
force-pushed
the
fix-askrene-single-path-quadratic-lag
branch
from
November 19, 2026 12:51
0801e06 to
99003a2
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
As reported in #9739 by @ksedgwic, calling
getrouteswithmaxparts=1freezes the askrene plugin before the route search even begins.When$O(N^2)$ scan of ~40,000 updates that stalls the main plugin process synchronously for up to 42 seconds before forking the child router.
maxparts == 1,do_getroutes()builds the temporary layerauto.remove_small_channelsto disable every channel smaller than the requested amount. Applying this layer callsfind_localmod(), which does a linear scan from the start oflocalmods->modsfor each update. On mainnet gossip (~50,000 channels), this triggers anSolution
Skip constructing the small-channel layer for single-path routing.
remove_small_channel_layer()was originally added in #8059 as a workaround to force the old MCF solver to find single paths. The dedicated single-path Dijkstra solver added in #8299 (init_linear_network_single_path()) already checks channel capacities inRemoving this layer drops setup time on real gossip data from 13.9s to 0.017s for 2,000,000 sat calls. It also resolves the longstanding
# FIXME: the explanation for the failure is wrongintest_getroutes_single_path, accurately reporting that a channel isn't big enough rather than claiming it was disabled by an internal layer.Fixes #9739
Checklist
Changelog-Fixed:).tools/lightning-downgrade(N/A, in-memory layer).