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:
7 files changed
+271
-168
No files matched your search
@@ -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