autopilot+config: support opening private channels with autopilot agent

This commit is contained in:
Wilmer Paulino
2018-08-06 14:02:31 -07:00
parent 6989316b11
commit 89325a13b7
3 changed files with 148 additions and 11 deletions

View File

@@ -16,7 +16,8 @@ import (
// chanController is an implementation of the autopilot.ChannelController
// interface that's backed by a running lnd instance.
type chanController struct {
server *server
server *server
private bool
}
// OpenChannel opens a channel to a target peer, with a capacity of the
@@ -89,7 +90,7 @@ func (c *chanController) OpenChannel(target *btcec.PublicKey,
minHtlc := lnwire.NewMSatFromSatoshis(1)
updateStream, errChan := c.server.OpenChannel(
target, amt, 0, minHtlc, feePerKw, false, 0,
target, amt, 0, minHtlc, feePerKw, c.private, 0,
)
select {
@@ -148,9 +149,12 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
// of the items that the autopilot agent needs to perform its duties.
self := svr.identityPriv.PubKey()
pilotCfg := autopilot.Config{
Self: self,
Heuristic: prefAttachment,
ChanController: &chanController{svr},
Self: self,
Heuristic: prefAttachment,
ChanController: &chanController{
server: svr,
private: cfg.Private,
},
WalletBalance: func() (btcutil.Amount, error) {
return svr.cc.wallet.ConfirmedBalance(1)
},