Skip to content

Commit

Permalink
routing: add the option to set the penultimate node on blinded path
Browse files Browse the repository at this point in the history
  • Loading branch information
MPins committed Sep 21, 2024
1 parent 237a25a commit 65a9c7f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions routing/pathfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,10 @@ type blindedPathRestrictions struct {
// nodeOmissionSet holds a set of node IDs of nodes that we should
// ignore during blinded path selection.
nodeOmissionSet fn.Set[route.Vertex]

// nodePenultimateSet holds a set of node IDs of nodes that we should
// use as penultimate hope during blinded path selection.
nodePenultimateSet fn.Set[route.Vertex]
}

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

// If we have explicity been told to consider this node as the
// penultimate hope.
if len(restrictions.nodePenultimateSet) > 0 {
if len(alreadyVisited) == 1 &&
!restrictions.nodePenultimateSet.Contains(node) {
return nil, false, nil
}
}

supports, err := supportsRouteBlinding(node)
if err != nil {
return nil, false, err
Expand Down

0 comments on commit 65a9c7f

Please sign in to comment.