mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 21:51:27 +02:00
autopilot: define AgentConstraints
To decouple the autopilot heuristic from the constraints, we start by abstracting them behind an interface to make them easier to mock. We also rename them HeuristicConstraints->AgentConstraints to make it clear that they are now constraints the agent must adhere to.
This commit is contained in:
14
pilot.go
14
pilot.go
@@ -87,13 +87,13 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) *autopilot.ManagerCfg {
|
||||
atplLog.Infof("Instantiating autopilot with cfg: %v", spew.Sdump(cfg))
|
||||
|
||||
// Set up the constraints the autopilot heuristics must adhere to.
|
||||
atplConstraints := &autopilot.HeuristicConstraints{
|
||||
MinChanSize: btcutil.Amount(cfg.MinChannelSize),
|
||||
MaxChanSize: btcutil.Amount(cfg.MaxChannelSize),
|
||||
ChanLimit: uint16(cfg.MaxChannels),
|
||||
Allocation: cfg.Allocation,
|
||||
MaxPendingOpens: 10,
|
||||
}
|
||||
atplConstraints := autopilot.NewConstraints(
|
||||
btcutil.Amount(cfg.MinChannelSize),
|
||||
btcutil.Amount(cfg.MaxChannelSize),
|
||||
uint16(cfg.MaxChannels),
|
||||
10,
|
||||
cfg.Allocation,
|
||||
)
|
||||
|
||||
// First, we'll create the preferential attachment heuristic,
|
||||
// initialized with the passed auto pilot configuration parameters.
|
||||
|
Reference in New Issue
Block a user