forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprobability_estimator.go
37 lines (30 loc) · 1.14 KB
/
probability_estimator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package routing
import (
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
)
// Estimator estimates the probability to reach a node.
type Estimator interface {
// PairProbability estimates the probability of successfully traversing
// to toNode based on historical payment outcomes for the from node.
// Those outcomes are passed in via the results parameter.
PairProbability(now time.Time, results NodeResults,
toNode route.Vertex, amt lnwire.MilliSatoshi,
capacity btcutil.Amount) float64
// LocalPairProbability estimates the probability of successfully
// traversing our own local channels to toNode.
LocalPairProbability(now time.Time, results NodeResults,
toNode route.Vertex) float64
// Config returns the estimator's configuration.
Config() estimatorConfig
// String returns the string representation of the estimator's
// configuration.
String() string
}
// estimatorConfig represents a configuration for a probability estimator.
type estimatorConfig interface {
// validate checks that all configuration parameters are sane.
validate() error
}