chainreg: add Config, move chainparams.go

Creates a Config that initializes the chainregistry struct in the
lnd package. Also moves all of chainparams.go to the chainreg
package.
This commit is contained in:
Eugene
2020-09-29 10:00:19 -07:00
committed by eugene
parent 933b959aa8
commit f4fe76aaf1
8 changed files with 189 additions and 93 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/autopilot"
"github.com/lightningnetwork/lnd/chainreg"
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/tor"
@ -76,7 +77,7 @@ type chanController struct {
minConfs int32
confTarget uint32
chanMinHtlcIn lnwire.MilliSatoshi
netParams bitcoinNetParams
netParams chainreg.BitcoinNetParams
}
// OpenChannel opens a channel to a target peer, with a capacity of the
@ -134,8 +135,8 @@ var _ autopilot.ChannelController = (*chanController)(nil)
// interfaces needed to drive it won't be launched before the Manager's
// StartAgent method is called.
func initAutoPilot(svr *server, cfg *lncfg.AutoPilot,
chainCfg *lncfg.Chain, netParams bitcoinNetParams) (*autopilot.ManagerCfg,
error) {
chainCfg *lncfg.Chain, netParams chainreg.BitcoinNetParams) (
*autopilot.ManagerCfg, error) {
atplLog.Infof("Instantiating autopilot with active=%v, "+
"max_channels=%d, allocation=%f, min_chan_size=%d, "+