routing: revert the swapping of in/out edges during path finding

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-10-18 21:51:07 -07:00
parent 23b6d84493
commit 8df69a83a7
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -464,14 +464,11 @@ func findPath(tx *bolt.Tx, graph *channeldb.ChannelGraph,
if _, ok := ignoredEdges[outEdge.ChannelID]; ok { if _, ok := ignoredEdges[outEdge.ChannelID]; ok {
return nil return nil
} }
if inEdge == nil {
return nil
}
// Compute the tentative distance to this new // Compute the tentative distance to this new
// channel/edge which is the distance to our current // channel/edge which is the distance to our current
// pivot node plus the weight of this edge. // 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 // If this new tentative distance is better than the
// current best known distance to this node, then we // 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 // specified by the node this channel
// connects to. // connects to.
edge: &ChannelHop{ edge: &ChannelHop{
ChannelEdgePolicy: inEdge, ChannelEdgePolicy: outEdge,
Capacity: edgeInfo.Capacity, Capacity: edgeInfo.Capacity,
}, },
prevNode: bestNode.PubKey, 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 // Add this new node to our heap as we'd like
// to further explore down this edge. // to further explore down this edge.
heap.Push(&nodeHeap, distance[v]) heap.Push(&nodeHeap, distance[v])