config+pilot: add flag to specify min confs for autopilot agent

This commit is contained in:
Wilmer Paulino
2018-08-09 19:03:08 -07:00
parent ae3e66dccc
commit 7724d86801
2 changed files with 15 additions and 5 deletions

View File

@ -17,8 +17,9 @@ import (
// chanController is an implementation of the autopilot.ChannelController
// interface that's backed by a running lnd instance.
type chanController struct {
server *server
private bool
server *server
private bool
minConfs int32
}
// OpenChannel opens a channel to a target peer, with a capacity of the
@ -48,6 +49,7 @@ func (c *chanController) OpenChannel(target *btcec.PublicKey,
fundingFeePerKw: feePerKw,
private: c.private,
remoteCsvDelay: 0,
minConfs: c.minConfs,
}
updateStream, errChan := c.server.OpenChannel(req)
@ -110,11 +112,12 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
Self: self,
Heuristic: prefAttachment,
ChanController: &chanController{
server: svr,
private: cfg.Private,
server: svr,
private: cfg.Private,
minConfs: cfg.MinConfs,
},
WalletBalance: func() (btcutil.Amount, error) {
return svr.cc.wallet.ConfirmedBalance(1)
return svr.cc.wallet.ConfirmedBalance(cfg.MinConfs)
},
Graph: autopilot.ChannelGraphFromDatabase(svr.chanDB.ChannelGraph()),
MaxPendingOpens: 10,