Skip to content
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

routing: fix mc blinded path behaviour. #9316

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/release-notes/release-notes-0.19.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
* [Make the contract resolutions for the channel arbitrator optional](
https://github.com/lightningnetwork/lnd/pull/9253)

* [Make sure blinded payment failures are handled correctly in the mission
controller](https://github.com/lightningnetwork/lnd/pull/9316).

# New Features
## Functional Enhancements
## RPC Additions
Expand Down
24 changes: 19 additions & 5 deletions routing/result_interpretation.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,25 @@ func (i *interpretedResult) processPaymentOutcomeIntermediate(route *mcRoute,
if introIdx == len(route.hops.Val)-1 {
i.finalFailureReason = &reasonError
} else {
// If there are other hops between the recipient and
// introduction node, then we just penalize the last
// hop in the blinded route to minimize the storage of
// results for ephemeral keys.
i.failPairBalance(route, len(route.hops.Val)-1)
// Penalize the first hop after the introduction node.
// This makes sure we do not retry this blinded path
// in our path finding logic with the same amount.
// In the pathfinding logic for blinded routes we swap
// the target pubkey for a general one so that
// multi-path payment can be attempted, so the last
// hop is not the one that we are considering during
// pathfinding. The case where the next hop after the
// introduction node is the final recipient is handled
// above, where we punish nothing but abort the payment
// by reporting a final failure reason.
//
// TODO(ziggie): Make sure we only keep mc data for
// blinded paths, in both the success and failure case,
// in memory during the time of the payment and remove
// it afterwards. Blinded paths and their blinded hop
// keys are always changing per blinded route so there
// is no point in persisting this data.
ellemouton marked this conversation as resolved.
Show resolved Hide resolved
i.failPairBalance(route, introIdx)
}

// In all other cases, we penalize the reporting node. These are all
Expand Down
4 changes: 2 additions & 2 deletions routing/result_interpretation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ var resultTestCases = []resultTestCase{
pairResults: map[DirectedNodePair]pairResult{
getTestPair(0, 1): successPairResult(100),
getTestPair(1, 2): successPairResult(99),
getTestPair(3, 4): failPairResult(88),
getTestPair(2, 3): failPairResult(95),
},
},
},
Expand All @@ -567,7 +567,7 @@ var resultTestCases = []resultTestCase{
expectedResult: &interpretedResult{
pairResults: map[DirectedNodePair]pairResult{
getTestPair(0, 1): successPairResult(100),
getTestPair(2, 3): failPairResult(75),
getTestPair(1, 2): failPairResult(90),
},
},
},
Expand Down
Loading