diff --git a/routing/pathfind.go b/routing/pathfind.go index e320d2f2..8279fa74 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -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, diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index 8d949d91..cccd6a58 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -431,11 +431,15 @@ func TestPathInsufficientCapacity(t *testing.T) { const payAmt = btcutil.SatoshiPerBitcoin _, err = findRoute(graph, target, payAmt) - if err != ErrInsufficientCapacity { + if err != ErrNoPathFound { t.Fatalf("graph shouldn't be able to support payment: %v", err) } } func TestPathInsufficientCapacityWithFee(t *testing.T) { // TODO(roasbeef): encode live graph to json + + // TODO(roasbeef): need to add a case, or modify the fee ratio for one + // to ensure that has going forward, but when fees are applied doesn't + // work }