Repository navigation
Conversation
Add onion budget and payload constructors to the internal xpay API. Onion budget computation can be used to know a realistic number of hops that constraints our payment before calling askrene. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Changelog-Changed: xpay: computes a budget for the number of hops in the payment depending on the final payload and blinded paths, it can fail early if the onion packet doesn't fit Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Lagrang3
force-pushed
the
xpay-limit-path-length-26.06
branch
from
October 23, 2026 10:30
bba4723 to
8598598
Compare
Member
|
I think you may have accidentally rebadged on top of some other branch that is not part of |
Lagrang3
force-pushed
the
xpay-limit-path-length-26.06
branch
from
October 26, 2026 08:36
8598598 to
3d04549
Compare
Added an homogeneous and constant cost to every hop in the MCF solver.
test_real_data shows a slight decrease of paths lengths by looking at
the path length histograms
SLOW_MACHINE=0
histogram before {2: 1, 3: 8, 4: 34, 5: 77, 6: 45, 7: 23, 8: 4}
histogram after {2: 2, 3: 59, 4: 110, 5: 5, 6: 5}
SLOW_MACHINE=1
histograms before {2: 1, 3: 3, 4: 11, 5: 15, 6: 6, 7: 6, 8: 3}
histogram after {2: 2, 3: 16, 4: 18, 5: 1, 6: 5}
the most frequent path length moves from 5 to 4 and there aren't more
than 6 hops in any given path.
Another consequence of the additional per hop cost is a slight reduction
in the number paths (or payment parts) per route query. Even though our linear
approximation gives equal cost to 3 paths of length 1 than to 1 path of
length 3.
in test_real_data this is shown by the expected_first_success (the
number of success computations in the first loop) and
expected_total_paths (the total number of parts for those successes,
also the sum of values in the histogram).
For SLOW_MACHINE=0 we get a mean parts per payment of
expected_total_paths / expected_first_success = 192 / 95 = 2.02
that becomes
expected_total_paths / expected_first_success = 181 / 95 = 1.90
For SLOW_MACHINE=1 we get a mean parts per payment of
expected_total_paths / expected_first_success = 45 / 24 = 1.87
that becomes
expected_total_paths / expected_first_success = 42 / 24 = 1.75
Changelog-Changed: askrene-getroutes: penalizes every extra hop in every route with an homogeneous and constant probability of failure of 1%, as a consequence askrene will slightly prefer smaller routes and fewer payment parts.
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Treat all cost features as the same type of variable. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Use cost dials normalized to 1 to combine the cost of different features. This is a generalization of the mu factor combination with medians ratio applied to more than 2 features: fees and delays. Just like that fee constraining got slightly better. Before mu (the corresponding fee dial) started at 1% and increased linearly in chunks of 10%. Now every dial is increased by a factor of 2 per iteration and it approximates 1 asymptotically as the dials are renormalized at each iteration. We have a cut-off at 1 - 1e-6, that means 27 iterations until mu reaches the cut-off. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
No updates to the RPC, no need to run as developer. We inject the maxhops value through a layer name. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Fail early if we see detect a suggestion that a pair of cost dials are racing each other. We are not likely to find a solution and we would just waste cycles. This usually means that our method is not able to find a solution that satisfies all given constraints. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Changelog-Fixed: xpay: Clamp the length of the payment routes using askrene's maxhops option aiming at producing routes that fit the data limits in the onion packet. Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Lagrang3
force-pushed
the
xpay-limit-path-length-26.06
branch
from
October 27, 2026 18:07
3d04549 to
d5d2044
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.
Similar to #9627, but with a little hack to call
maxhopson askrene without needing to modify the RPC.It is rebased on top of v26.06.9