routing: add sufficient link capacity to our relaxation condition
This commit modifies our modified version of Dijkstra's to include sufficient link capacity within the algorithm’s relaxation condition. With this change, we’ll now avoid exploring the graph in the direction of a link that has insufficient capacity, allowing us to terminate path finding more quickly.
This commit is contained in:
2 files changed
+8
-2
No files matched your search
+3
-1
@@ -331,7 +331,9 @@ func findRoute(graph *channeldb.ChannelGraph, target *btcec.PublicKey,
|
||||
// TODO(roasbeef): add capacity to relaxation criteria?
|
||||
// * also add min payment?
|
||||
v := newVertex(edge.Node.PubKey)
|
||||
if tempDist < distance[v].dist {
|
||||
if tempDist < distance[v].dist &&
|
||||
edgeInfo.Capacity >= amt {
|
||||
|
||||
distance[v] = nodeWithDist{
|
||||
dist: tempDist,
|
||||
node: edge.Node,
|
||||
|
||||
Reference in new issue
Block a user