From 8df69a83a72b1c998949acbb429d4284cd58ab87 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 18 Oct 2017 21:51:07 -0700 Subject: [PATCH] routing: revert the swapping of in/out edges during path finding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this commit we revert a commit which was added in the past as way to allow the path -> route conversion code to remain the same, while properly respecting the necessary time locks and fees. In an upcoming change, this swap is no longer necessary as we’ll always use: the time lock of the outgoing node and the fee of the incoming node. --- routing/pathfind.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/routing/pathfind.go b/routing/pathfind.go index 9425b62b..7d8dc015 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -464,14 +464,11 @@ func findPath(tx *bolt.Tx, graph *channeldb.ChannelGraph, if _, ok := ignoredEdges[outEdge.ChannelID]; ok { return nil } - if inEdge == nil { - return nil - } // Compute the tentative distance to this new // channel/edge which is the distance to our current // pivot node plus the weight of this edge. - tempDist := distance[pivot].dist + edgeWeight(inEdge) + tempDist := distance[pivot].dist + edgeWeight(outEdge) // If this new tentative distance is better than the // current best known distance to this node, then we @@ -495,20 +492,12 @@ func findPath(tx *bolt.Tx, graph *channeldb.ChannelGraph, // specified by the node this channel // connects to. edge: &ChannelHop{ - ChannelEdgePolicy: inEdge, + ChannelEdgePolicy: outEdge, Capacity: edgeInfo.Capacity, }, prevNode: bestNode.PubKey, } - // In order for the path unwinding to work - // properly, we'll ensure that this edge - // properly points to the outgoing node. - // - // TODO(roasbeef): revisit, possibly switch db - // format? - prev[v].edge.Node = outEdge.Node - // Add this new node to our heap as we'd like // to further explore down this edge. heap.Push(&nodeHeap, distance[v])