config+pilot: add new config params to specify min+max autopilot chan size

In this commit, we add two new configuration parameters to allow users
to specify the min and max size that the autopilot agent will create.
This is useful as now users can set the values to more or less the same
size, which will allow them to control the size of each created
channel.

Before this commit, if this wasn’t set, then the agent would try to
shove as much money into a channel up until the max chan size. This was
nice on testnet, but on main net, users will likely not want all their
funds to be in a single channel, and instead be distributed across many
channels. With things like AMP, have more channels becomes more
desirable.
This commit is contained in:
Olaoluwa Osuntokun
2018-03-18 17:10:01 -07:00
parent 8127685462
commit 76f7a66259
2 changed files with 47 additions and 10 deletions

View File

@@ -142,11 +142,9 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
// First, we'll create the preferential attachment heuristic,
// initialized with the passed auto pilot configuration parameters.
//
// TODO(roasbeef): switch here to dispatch specified heuristic
minChanSize := svr.cc.wallet.Cfg.DefaultConstraints.DustLimit * 5
prefAttachment := autopilot.NewConstrainedPrefAttachment(
minChanSize, maxFundingAmount,
btcutil.Amount(cfg.MinChannelSize),
btcutil.Amount(cfg.MaxChannelSize),
uint16(cfg.MaxChannels), cfg.Allocation,
)