mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-30 02:21:08 +02:00
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:
@ -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