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:
parent
0b0a9f4172
commit
998680ad59
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user