Skip to content

Commit 067e316

Browse files
committed
routing: clean-up the tests a bit
This is just in preparation for the next commit. The test will be cleaned up more after a bug is fixed.
1 parent 4bc0aee commit 067e316

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

routing/pathfind_test.go

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3898,7 +3898,7 @@ func TestFindBlindedPaths(t *testing.T) {
38983898
"eve,bob,dave",
38993899
})
39003900

3901-
// 5) Finally, we will test the special case where the destination node
3901+
// 5) We will also test the special case where the destination node
39023902
// is also the recipient.
39033903
paths, err = ctx.findBlindedPaths(&blindedPathRestrictions{
39043904
minNumHops: 0,
@@ -3910,31 +3910,11 @@ func TestFindBlindedPaths(t *testing.T) {
39103910
"dave",
39113911
})
39123912

3913-
// 6) Restrict the min & max path length such that we only include paths
3914-
// with one being only the intro-node and the others with one hop other
3915-
// than the destination hop.
3916-
paths, err = ctx.findBlindedPaths(&blindedPathRestrictions{
3917-
minNumHops: 0,
3918-
maxNumHops: 1,
3919-
})
3920-
require.NoError(t, err)
3921-
3922-
// We expect the following paths:
3923-
// - D
3924-
// - B, D
3925-
// - C, D
3926-
// The (A, D) path is not chosen since A does not advertise the route
3927-
// blinding feature bit. The (G, D) path is not chosen since G does not
3928-
// have any other known channels.
3929-
assertPaths(paths, []string{
3930-
"dave",
3931-
"bob,dave",
3932-
"charlie,dave",
3933-
})
3934-
3935-
// 7) Restrict the min & max path length such that we only include paths
3936-
// with one hop other than the destination hop. Now with bob-dave as the
3937-
// incoming channel.
3913+
// 6) Now, we will test some cases where the user manually specifies
3914+
// the first few incoming channels of a route.
3915+
//
3916+
// 6.1) Let the user specify the B-D channel as the last hop with a
3917+
// max of 1 hop.
39383918
paths, err = ctx.findBlindedPaths(&blindedPathRestrictions{
39393919
minNumHops: 1,
39403920
maxNumHops: 1,
@@ -3944,13 +3924,13 @@ func TestFindBlindedPaths(t *testing.T) {
39443924
})
39453925
require.NoError(t, err)
39463926

3947-
// Expect only B->D path.
3927+
// If the max number of hops is 1, then only the B->D path is chosen
39483928
assertPaths(paths, []string{
39493929
"bob,dave",
39503930
})
39513931

3952-
// 8) Extend the search to include 2 hops other than the destination,
3953-
// with bob-dave as the incoming channel.
3932+
// 6.2) Extend the search to include 2 hops along with the B-D channel
3933+
// restriction.
39543934
paths, err = ctx.findBlindedPaths(&blindedPathRestrictions{
39553935
minNumHops: 1,
39563936
maxNumHops: 2,
@@ -3968,7 +3948,7 @@ func TestFindBlindedPaths(t *testing.T) {
39683948
"eve,bob,dave",
39693949
})
39703950

3971-
// 9) Extend the search even further and also increase the minimum path
3951+
// 6.3) Extend the search even further and also increase the minimum path
39723952
// length, but this time with charlie-dave as the incoming channel.
39733953
paths, err = ctx.findBlindedPaths(&blindedPathRestrictions{
39743954
minNumHops: 2,
@@ -3987,7 +3967,7 @@ func TestFindBlindedPaths(t *testing.T) {
39873967
"bob,eve,charlie,dave",
39883968
})
39893969

3990-
// 10) Repeat the above test but instruct the function to never use
3970+
// 6.4) Repeat the above test but instruct the function to never use
39913971
// charlie.
39923972
_, err = ctx.findBlindedPaths(&blindedPathRestrictions{
39933973
minNumHops: 2,
@@ -4000,7 +3980,7 @@ func TestFindBlindedPaths(t *testing.T) {
40003980
require.ErrorContains(t, err, "cannot simultaneously be included in "+
40013981
"the omission set and in the partially specified path")
40023982

4003-
// 11) Assert that an error is returned if a user accidentally tries
3983+
// 6.5) Assert that an error is returned if a user accidentally tries
40043984
// to force a circular path.
40053985
_, err = ctx.findBlindedPaths(&blindedPathRestrictions{
40063986
minNumHops: 2,

0 commit comments

Comments
 (0)