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:
6 files changed
+99
-42
No files matched your search
@@ -2231,7 +2231,10 @@ func TestNewRouteRequest(t *testing.T) {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var blindedPathInfo *BlindedPaymentPathSet
|
||||
var (
|
||||
blindedPathInfo *BlindedPaymentPathSet
|
||||
expectedTarget = testCase.expectedTarget
|
||||
)
|
||||
if testCase.blindedPayment != nil {
|
||||
blindedPathInfo, err = NewBlindedPaymentPathSet(
|
||||
[]*BlindedPayment{
|
||||
@@ -2239,6 +2242,10 @@ func TestNewRouteRequest(t *testing.T) {
|
||||
},
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
expectedTarget = route.NewVertex(
|
||||
blindedPathInfo.TargetPubKey(),
|
||||
)
|
||||
}
|
||||
|
||||
req, err := NewRouteRequest(
|
||||
@@ -2253,7 +2260,7 @@ func TestNewRouteRequest(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
require.Equal(t, req.Target, testCase.expectedTarget)
|
||||
require.Equal(t, req.Target, expectedTarget)
|
||||
require.Equal(
|
||||
t, req.FinalExpiry, testCase.expectedCltv,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user