routing: fall back to edge MaxHTLC within findPath instead of Capacity

In this commit, we make our findPath function use an edge's MaxHTLC as
its available bandwidth instead of its Capacity. We do this as it's
possible for the capacity of an edge to not exist when operating as a
light client. For channels that do not support the MaxHTLC optional
field, we'll fall back to using the edge's Capacity.
This commit is contained in:
Wilmer Paulino 2019-04-17 13:26:52 -07:00
parent 0b0a9f4172
commit 998680ad59
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -693,11 +693,16 @@ func findPath(g *graphParams, r *RestrictParams, source, target Vertex,
edgeBandwidth, ok := g.bandwidthHints[edgeInfo.ChannelID]
if !ok {
// If we don't have a hint for this edge, then
// we'll just use the known Capacity as the
// available bandwidth.
edgeBandwidth = lnwire.NewMSatFromSatoshis(
edgeInfo.Capacity,
)
// we'll just use the known Capacity/MaxHTLC as
// the available bandwidth. It's possible for
// the capacity to be unknown when operating
// under a light client.
edgeBandwidth = inEdge.MaxHTLC
if edgeBandwidth == 0 {
edgeBandwidth = lnwire.NewMSatFromSatoshis(
edgeInfo.Capacity,
)
}
}
// Before we can process the edge, we'll need to fetch