Skip to content

Commit 65a9c7f

Browse files
committed
routing: add the option to set the penultimate node on blinded path
1 parent 237a25a commit 65a9c7f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

routing/pathfind.go

+13
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,10 @@ type blindedPathRestrictions struct {
11681168
// nodeOmissionSet holds a set of node IDs of nodes that we should
11691169
// ignore during blinded path selection.
11701170
nodeOmissionSet fn.Set[route.Vertex]
1171+
1172+
// nodePenultimateSet holds a set of node IDs of nodes that we should
1173+
// use as penultimate hope during blinded path selection.
1174+
nodePenultimateSet fn.Set[route.Vertex]
11711175
}
11721176

11731177
// blindedHop holds the information about a hop we have selected for a blinded
@@ -1277,6 +1281,15 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
12771281
return nil, false, nil
12781282
}
12791283

1284+
// If we have explicity been told to consider this node as the
1285+
// penultimate hope.
1286+
if len(restrictions.nodePenultimateSet) > 0 {
1287+
if len(alreadyVisited) == 1 &&
1288+
!restrictions.nodePenultimateSet.Contains(node) {
1289+
return nil, false, nil
1290+
}
1291+
}
1292+
12801293
supports, err := supportsRouteBlinding(node)
12811294
if err != nil {
12821295
return nil, false, err

0 commit comments

Comments
 (0)