mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-07 11:22:37 +01:00
routing: swap out final hop blinded route pub keys
If multiple blinded paths are provided, they will each have a different pub key for the destination node. This makes using our existing pathfinding logic tricky since it depends on having a single destination node (characterised by a single pub key). We want to re-use this logic. So what we do is swap out the pub keys of the destinaion hop with a pseudo target pub key. This will then be used during pathfinding. Later on once a path is found, we will swap the real destination keys back in so that onion creation can be done.
This commit is contained in:
@@ -573,20 +573,7 @@ func getTargetNode(target *route.Vertex,
|
||||
return route.Vertex{}, ErrTargetAndBlinded
|
||||
|
||||
case blinded:
|
||||
blindedPayment := blindedPathSet.GetPath()
|
||||
|
||||
// If we're dealing with an edge-case blinded path that just
|
||||
// has an introduction node (first hop expected to be the intro
|
||||
// hop), then we return the unblinded introduction node as our
|
||||
// target.
|
||||
hops := blindedPayment.BlindedPath.BlindedHops
|
||||
if len(hops) == 1 {
|
||||
return route.NewVertex(
|
||||
blindedPayment.BlindedPath.IntroductionPoint,
|
||||
), nil
|
||||
}
|
||||
|
||||
return route.NewVertex(hops[len(hops)-1].BlindedNodePub), nil
|
||||
return route.NewVertex(blindedPathSet.TargetPubKey()), nil
|
||||
|
||||
case targetSet:
|
||||
return *target, nil
|
||||
|
||||
Reference in New Issue
Block a user