diff --git a/routing/pathfind.go b/routing/pathfind.go index 4fa4d15f..743adad1 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -393,7 +393,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig, // processEdge is a helper closure that will be used to make sure edges // satisfy our specific requirements. processEdge := func(fromVertex route.Vertex, bandwidth lnwire.MilliSatoshi, - edge *channeldb.ChannelEdgePolicy, toNode route.Vertex) { + edge *channeldb.ChannelEdgePolicy, toNodeDist *nodeWithDist) { edgesExpanded++ @@ -420,17 +420,16 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig, // Calculate amount that the candidate node would have to sent // out. - toNodeDist := distance[toNode] amountToSend := toNodeDist.amountToReceive // Request the success probability for this edge. edgeProbability := r.ProbabilitySource( - fromVertex, toNode, amountToSend, + fromVertex, toNodeDist.node, amountToSend, ) log.Trace(newLogClosure(func() string { return fmt.Sprintf("path finding probability: fromnode=%v,"+ - " tonode=%v, probability=%v", fromVertex, toNode, + " tonode=%v, probability=%v", fromVertex, toNodeDist.node, edgeProbability) })) @@ -626,7 +625,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig, // Check if this candidate node is better than what we // already have. - processEdge(chanSource, edgeBandwidth, inEdge, pivot) + processEdge(chanSource, edgeBandwidth, inEdge, partialPath) return nil } @@ -646,7 +645,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig, bandWidth := partialPath.amountToReceive for _, reverseEdge := range additionalEdgesWithSrc[pivot] { processEdge(reverseEdge.sourceNode, bandWidth, - reverseEdge.edge, pivot) + reverseEdge.edge, partialPath) } }