mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 06:01:48 +02:00
routing: stricter mission control state failure updates
This commit puts a mechanism in place to prevent a failure for a low amount from being overwritten very soon after by a higher amount failure.
This commit is contained in:
@@ -50,6 +50,11 @@ const (
|
||||
// DefaultAprioriWeight is the default a priori weight. See
|
||||
// MissionControlConfig for further explanation.
|
||||
DefaultAprioriWeight = 0.5
|
||||
|
||||
// DefaultMinFailureRelaxInterval is the default minimum time that must
|
||||
// have passed since the previously recorded failure before the failure
|
||||
// amount may be raised.
|
||||
DefaultMinFailureRelaxInterval = time.Minute
|
||||
)
|
||||
|
||||
// NodeResults contains previous results from a node to its peers.
|
||||
@@ -113,6 +118,11 @@ type MissionControlConfig struct {
|
||||
// results, unless there are none available.
|
||||
AprioriWeight float64
|
||||
|
||||
// MinFailureRelaxInterval is the minimum time that must have passed
|
||||
// since the previously recorded failure before the failure amount may
|
||||
// be raised.
|
||||
MinFailureRelaxInterval time.Duration
|
||||
|
||||
// SelfNode is our own pubkey.
|
||||
SelfNode route.Vertex
|
||||
}
|
||||
@@ -188,7 +198,7 @@ func NewMissionControl(db kvdb.Backend, cfg *MissionControlConfig) (
|
||||
}
|
||||
|
||||
mc := &MissionControl{
|
||||
state: newMissionControlState(),
|
||||
state: newMissionControlState(cfg.MinFailureRelaxInterval),
|
||||
now: time.Now,
|
||||
cfg: cfg,
|
||||
store: store,
|
||||
|
Reference in New Issue
Block a user