mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2026-02-22 06:54:20 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user