mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-21 18:42:40 +02:00
config+pilot: add flag to specify min confs for autopilot agent
This commit is contained in:
@ -146,6 +146,7 @@ type autoPilotConfig struct {
|
|||||||
MinChannelSize int64 `long:"minchansize" description:"The smallest channel that the autopilot agent should create"`
|
MinChannelSize int64 `long:"minchansize" description:"The smallest channel that the autopilot agent should create"`
|
||||||
MaxChannelSize int64 `long:"maxchansize" description:"The largest channel that the autopilot agent should create"`
|
MaxChannelSize int64 `long:"maxchansize" description:"The largest channel that the autopilot agent should create"`
|
||||||
Private bool `long:"private" description:"Whether the channels created by the autopilot agent should be private or not. Private channels won't be announced to the network."`
|
Private bool `long:"private" description:"Whether the channels created by the autopilot agent should be private or not. Private channels won't be announced to the network."`
|
||||||
|
MinConfs int32 `long:"minconfs" description:"The minimum number of confirmations each of your inputs in funding transactions created by the autopilot agent must have."`
|
||||||
}
|
}
|
||||||
|
|
||||||
type torConfig struct {
|
type torConfig struct {
|
||||||
@ -424,6 +425,12 @@ func loadConfig() (*config, error) {
|
|||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if cfg.Autopilot.MinConfs < 0 {
|
||||||
|
str := "%s: autopilot.minconfs must be non-negative"
|
||||||
|
err := fmt.Errorf(str, funcName)
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that the specified values for the min and max channel size
|
// Ensure that the specified values for the min and max channel size
|
||||||
// don't are within the bounds of the normal chan size constraints.
|
// don't are within the bounds of the normal chan size constraints.
|
||||||
|
5
pilot.go
5
pilot.go
@ -19,6 +19,7 @@ import (
|
|||||||
type chanController struct {
|
type chanController struct {
|
||||||
server *server
|
server *server
|
||||||
private bool
|
private bool
|
||||||
|
minConfs int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenChannel opens a channel to a target peer, with a capacity of the
|
// 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,
|
fundingFeePerKw: feePerKw,
|
||||||
private: c.private,
|
private: c.private,
|
||||||
remoteCsvDelay: 0,
|
remoteCsvDelay: 0,
|
||||||
|
minConfs: c.minConfs,
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStream, errChan := c.server.OpenChannel(req)
|
updateStream, errChan := c.server.OpenChannel(req)
|
||||||
@ -112,9 +114,10 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
|
|||||||
ChanController: &chanController{
|
ChanController: &chanController{
|
||||||
server: svr,
|
server: svr,
|
||||||
private: cfg.Private,
|
private: cfg.Private,
|
||||||
|
minConfs: cfg.MinConfs,
|
||||||
},
|
},
|
||||||
WalletBalance: func() (btcutil.Amount, error) {
|
WalletBalance: func() (btcutil.Amount, error) {
|
||||||
return svr.cc.wallet.ConfirmedBalance(1)
|
return svr.cc.wallet.ConfirmedBalance(cfg.MinConfs)
|
||||||
},
|
},
|
||||||
Graph: autopilot.ChannelGraphFromDatabase(svr.chanDB.ChannelGraph()),
|
Graph: autopilot.ChannelGraphFromDatabase(svr.chanDB.ChannelGraph()),
|
||||||
MaxPendingOpens: 10,
|
MaxPendingOpens: 10,
|
||||||
|
Reference in New Issue
Block a user