[v0.21.x-branch] Backport #10771: routerrpc: isolate LSP route fee probes#10834
Merged
Merged
Conversation
(cherry picked from commit 1dd09d2)
Author
|
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-10771-to-v0.21.x-branch
git worktree add --checkout .worktree/backport-10771-to-v0.21.x-branch backport-10771-to-v0.21.x-branch
cd .worktree/backport-10771-to-v0.21.x-branch
git reset --hard HEAD^
git cherry-pick -x 8eab1edd69887e4935b3e06eccf558902b29ffdd
git push --force-with-lease |
2ca6bf3 to
c709ec5
Compare
Author
PR Severity: HIGH
High (1 file)
Excluded from classification (1 file)
AnalysisThis PR modifies Scope: 1 non-test file, 36 lines changed -- no bump triggered (thresholds: more than 20 non-test files or more than 500 non-test lines). To override, add a |
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.
Backport of #10771
The last commit which added the release notes where already added in commit: df04aaf so we drop the last commit here.
Summary
EstimateRouteFeeLSP probe so later probes cannot reuse payment-level state from earlier probes.EstimateRouteFeefix.Fix #10677
Bug
CI flaked in PR #10689 on the
bitcoind-etcditest job:https://github.com/lightningnetwork/lnd/actions/runs/24841352445/job/72716012767?pr=10689
Failed test:
Failure:
The test creates three public LSP hints for a private destination:
100200120The returned fee was Eve's fee, but the returned timelock was calculated with Bob's CLTV delta.
Root Cause
probePaymentRequestgenerated one random payment hash for the overall invoice probe request, then reused that same hash for every per-LSP probe.The payment lifecycle keys payment state by payment hash. If Bob is probed first, the payment record is initialized with Bob's
FinalCltvDelta=100. When Eve is probed later with the same payment hash, the router treats it as another attempt for the same payment and can reuse payment-level state from the first probe. The route can then carry Eve's fee but Bob's CLTV delta.This is order-dependent because LSPs are iterated from a Go map. If Eve is probed first, the test passes. If Bob is probed first, Eve can inherit Bob's CLTV delta and the test fails.
Log Evidence
I downloaded the itest artifact
logs-itest-bitcoind-etcd.zipfrom the failed run. Relevant log file:Passing two-LSP case: Eve is probed first, uses expiry/cltv
864, and the final result returnstimelock: 944.Failing three-LSP case: Bob is probed first with payment hash
a539...andcltv 764. Eve is probed next with the same payment hash, logsResuming HTLC attempt, still usescltv 764, succeeds with Eve's fee, and returnstimelock: 844.The
100delta between expected944and actual844matches Bob's LSP CLTV delta being used where Eve's200should have been used.Fix
Generate a fresh random payment hash for each LSP probe iteration. This makes each LSP probe an independent payment from the payment lifecycle's perspective, while keeping the existing single-hash behavior for the non-LSP probe path.
Testing
GOWORK=off go test ./lnrpc/routerrpc