routing: use capacity in pathfinding

Extends the pathfinder with a capacity argument for later usage.

In tests, the inserted testCapacity has no effect, but will be used
later to estimate reduced probabilities from it.
This commit is contained in:
bitromortac
2022-05-26 10:18:12 +02:00
parent 2b6308a61f
commit 516e3a8cca
11 changed files with 70 additions and 37 deletions

View File

@ -5,6 +5,7 @@ import (
"math"
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
)
@ -150,8 +151,8 @@ func (p *probabilityEstimator) getWeight(age time.Duration) float64 {
// toNode based on historical payment outcomes for the from node. Those outcomes
// are passed in via the results parameter.
func (p *probabilityEstimator) getPairProbability(
now time.Time, results NodeResults,
toNode route.Vertex, amt lnwire.MilliSatoshi) float64 {
now time.Time, results NodeResults, toNode route.Vertex,
amt lnwire.MilliSatoshi, capacity btcutil.Amount) float64 {
nodeProbability := p.getNodeProbability(now, results, amt)