Skip to content

Commit

Permalink
routing: modify the TestFindBlindedPathsWithMC to not use MaxNumPaths
Browse files Browse the repository at this point in the history
MaxNumPaths restriction moved from FindBlindedPaths to BuildBlindedPaymentPaths
this way we can interact through all possibly routes when creating a new
blinded path.
  • Loading branch information
MPins committed Dec 13, 2024
1 parent e6f8f8d commit 415eddd
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions routing/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3167,7 +3167,6 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 3,
},
)
require.NoError(t, err)
Expand Down Expand Up @@ -3201,8 +3200,7 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
}

// Now, let's lower the MC probability of the B-D to 0.5 and F-D link to
// 0.25. We will leave the MaxNumPaths as 3 and so all paths should
// still be returned but the order should be:
// 0.25:
// 1) A -> C -> D
// 2) A -> B -> D
// 3) A -> F -> D
Expand All @@ -3212,7 +3210,6 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 3,
},
)
require.NoError(t, err)
Expand All @@ -3229,7 +3226,6 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 3,
},
)
require.NoError(t, err)
Expand All @@ -3239,27 +3235,12 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
"alice,charlie,dave",
})

// Change the MaxNumPaths to 1 to assert that only the best route is
// returned.
routes, err = ctx.router.FindBlindedPaths(
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 1,
},
)
require.NoError(t, err)
assertPaths(routes, []string{
"alice,bob,dave",
})

// Test the edge case where Dave, the recipient, is also the
// introduction node.
routes, err = ctx.router.FindBlindedPaths(
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 0,
NumHops: 0,
MaxNumPaths: 1,
},
)
require.NoError(t, err)
Expand All @@ -3274,7 +3255,6 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 3,
},
)
require.NoError(t, err)
Expand All @@ -3289,7 +3269,6 @@ func TestFindBlindedPathsWithMC(t *testing.T) {
dave, 1000, probabilitySrc, &BlindedPathRestrictions{
MinDistanceFromIntroNode: 2,
NumHops: 2,
MaxNumPaths: 3,
NodeOmissionSet: fn.NewSet(frank),
},
)
Expand Down

0 comments on commit 415eddd

Please sign in to comment.