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

@@ -6,6 +6,7 @@ import (
"sync"
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnwire"
@@ -333,7 +334,7 @@ func (m *MissionControl) ResetHistory() error {
// GetProbability is expected to return the success probability of a payment
// from fromNode along edge.
func (m *MissionControl) GetProbability(fromNode, toNode route.Vertex,
amt lnwire.MilliSatoshi) float64 {
amt lnwire.MilliSatoshi, capacity btcutil.Amount) float64 {
m.Lock()
defer m.Unlock()
@@ -346,7 +347,9 @@ func (m *MissionControl) GetProbability(fromNode, toNode route.Vertex,
return m.estimator.getLocalPairProbability(now, results, toNode)
}
return m.estimator.getPairProbability(now, results, toNode, amt)
return m.estimator.getPairProbability(
now, results, toNode, amt, capacity,
)
}
// GetHistorySnapshot takes a snapshot from the current mission control state