mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-05 17:30:21 +02:00
multi: remove ChainRegistry
This commit is contained in:
parent
2a7fffe441
commit
031dbd7760
@ -1,25 +0,0 @@
|
|||||||
package chainreg
|
|
||||||
|
|
||||||
// ChainCode is an enum-like structure for keeping track of the chains
|
|
||||||
// currently supported within lnd.
|
|
||||||
type ChainCode uint32
|
|
||||||
|
|
||||||
const (
|
|
||||||
// BitcoinChain is Bitcoin's chain.
|
|
||||||
BitcoinChain ChainCode = iota
|
|
||||||
|
|
||||||
// LitecoinChain is Litecoin's chain.
|
|
||||||
LitecoinChain
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns a string representation of the target ChainCode.
|
|
||||||
func (c ChainCode) String() string {
|
|
||||||
switch c {
|
|
||||||
case BitcoinChain:
|
|
||||||
return "bitcoin"
|
|
||||||
case LitecoinChain:
|
|
||||||
return "litecoin"
|
|
||||||
default:
|
|
||||||
return "kekcoin"
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
@ -42,10 +41,6 @@ type Config struct {
|
|||||||
// Bitcoin defines settings for the Bitcoin chain.
|
// Bitcoin defines settings for the Bitcoin chain.
|
||||||
Bitcoin *lncfg.Chain
|
Bitcoin *lncfg.Chain
|
||||||
|
|
||||||
// PrimaryChain is a function that returns our primary chain via its
|
|
||||||
// ChainCode.
|
|
||||||
PrimaryChain func() ChainCode
|
|
||||||
|
|
||||||
// HeightHintCacheQueryDisable is a boolean that disables height hint
|
// HeightHintCacheQueryDisable is a boolean that disables height hint
|
||||||
// queries if true.
|
// queries if true.
|
||||||
HeightHintCacheQueryDisable bool
|
HeightHintCacheQueryDisable bool
|
||||||
@ -224,32 +219,19 @@ func GenDefaultBtcConstraints() channeldb.ChannelConstraints {
|
|||||||
//
|
//
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||||
// Set the RPC config from the "home" chain. Multi-chain isn't yet
|
|
||||||
// active, so we'll restrict usage to a particular chain for now.
|
|
||||||
homeChainConfig := cfg.Bitcoin
|
|
||||||
|
|
||||||
log.Infof("Primary chain is set to: %v", cfg.PrimaryChain())
|
|
||||||
|
|
||||||
cc := &PartialChainControl{
|
cc := &PartialChainControl{
|
||||||
Cfg: cfg,
|
Cfg: cfg,
|
||||||
}
|
RoutingPolicy: models.ForwardingPolicy{
|
||||||
|
|
||||||
switch cfg.PrimaryChain() {
|
|
||||||
case BitcoinChain:
|
|
||||||
cc.RoutingPolicy = models.ForwardingPolicy{
|
|
||||||
MinHTLCOut: cfg.Bitcoin.MinHTLCOut,
|
MinHTLCOut: cfg.Bitcoin.MinHTLCOut,
|
||||||
BaseFee: cfg.Bitcoin.BaseFee,
|
BaseFee: cfg.Bitcoin.BaseFee,
|
||||||
FeeRate: cfg.Bitcoin.FeeRate,
|
FeeRate: cfg.Bitcoin.FeeRate,
|
||||||
TimeLockDelta: cfg.Bitcoin.TimeLockDelta,
|
TimeLockDelta: cfg.Bitcoin.TimeLockDelta,
|
||||||
}
|
},
|
||||||
cc.MinHtlcIn = cfg.Bitcoin.MinHTLCIn
|
MinHtlcIn: cfg.Bitcoin.MinHTLCIn,
|
||||||
cc.FeeEstimator = chainfee.NewStaticEstimator(
|
FeeEstimator: chainfee.NewStaticEstimator(
|
||||||
DefaultBitcoinStaticFeePerKW,
|
DefaultBitcoinStaticFeePerKW,
|
||||||
DefaultBitcoinStaticMinRelayFeeRate,
|
DefaultBitcoinStaticMinRelayFeeRate,
|
||||||
)
|
),
|
||||||
default:
|
|
||||||
return nil, nil, fmt.Errorf("default routing policy for chain "+
|
|
||||||
"%v is unknown", cfg.PrimaryChain())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@ -272,7 +254,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
|||||||
// If spv mode is active, then we'll be using a distinct set of
|
// If spv mode is active, then we'll be using a distinct set of
|
||||||
// chainControl interfaces that interface directly with the p2p network
|
// chainControl interfaces that interface directly with the p2p network
|
||||||
// of the selected chain.
|
// of the selected chain.
|
||||||
switch homeChainConfig.Node {
|
switch cfg.Bitcoin.Node {
|
||||||
case "neutrino":
|
case "neutrino":
|
||||||
// We'll create ChainNotifier and FilteredChainView instances,
|
// We'll create ChainNotifier and FilteredChainView instances,
|
||||||
// along with the wallet's ChainSource, which are all backed by
|
// along with the wallet's ChainSource, which are all backed by
|
||||||
@ -682,7 +664,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("unknown node type: %s",
|
return nil, nil, fmt.Errorf("unknown node type: %s",
|
||||||
homeChainConfig.Node)
|
cfg.Bitcoin.Node)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
@ -690,7 +672,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
|||||||
// we'll return an error to instruct them to set a proper fee
|
// we'll return an error to instruct them to set a proper fee
|
||||||
// estimator.
|
// estimator.
|
||||||
case cfg.FeeURL == "" && cfg.Bitcoin.MainNet &&
|
case cfg.FeeURL == "" && cfg.Bitcoin.MainNet &&
|
||||||
homeChainConfig.Node == "neutrino":
|
cfg.Bitcoin.Node == "neutrino":
|
||||||
|
|
||||||
return nil, nil, fmt.Errorf("--feeurl parameter required " +
|
return nil, nil, fmt.Errorf("--feeurl parameter required " +
|
||||||
"when running neutrino on mainnet")
|
"when running neutrino on mainnet")
|
||||||
@ -834,13 +816,6 @@ var (
|
|||||||
0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
})
|
})
|
||||||
|
|
||||||
// chainMap is a simple index that maps a chain's genesis hash to the
|
|
||||||
// ChainCode enum for that chain.
|
|
||||||
chainMap = map[chainhash.Hash]ChainCode{
|
|
||||||
BitcoinTestnetGenesis: BitcoinChain,
|
|
||||||
BitcoinMainnetGenesis: BitcoinChain,
|
|
||||||
}
|
|
||||||
|
|
||||||
// ChainDNSSeeds is a map of a chain's hash to the set of DNS seeds
|
// ChainDNSSeeds is a map of a chain's hash to the set of DNS seeds
|
||||||
// that will be use to bootstrap peers upon first startup.
|
// that will be use to bootstrap peers upon first startup.
|
||||||
//
|
//
|
||||||
@ -878,98 +853,3 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChainRegistry keeps track of the current chains.
|
|
||||||
type ChainRegistry struct {
|
|
||||||
sync.RWMutex
|
|
||||||
|
|
||||||
activeChains map[ChainCode]*ChainControl
|
|
||||||
netParams map[ChainCode]*BitcoinNetParams
|
|
||||||
|
|
||||||
primaryChain ChainCode
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewChainRegistry creates a new ChainRegistry.
|
|
||||||
func NewChainRegistry() *ChainRegistry {
|
|
||||||
return &ChainRegistry{
|
|
||||||
activeChains: make(map[ChainCode]*ChainControl),
|
|
||||||
netParams: make(map[ChainCode]*BitcoinNetParams),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterChain assigns an active ChainControl instance to a target chain
|
|
||||||
// identified by its ChainCode.
|
|
||||||
func (c *ChainRegistry) RegisterChain(newChain ChainCode,
|
|
||||||
cc *ChainControl) {
|
|
||||||
|
|
||||||
c.Lock()
|
|
||||||
c.activeChains[newChain] = cc
|
|
||||||
c.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// LookupChain attempts to lookup an active ChainControl instance for the
|
|
||||||
// target chain.
|
|
||||||
func (c *ChainRegistry) LookupChain(targetChain ChainCode) (
|
|
||||||
*ChainControl, bool) {
|
|
||||||
|
|
||||||
c.RLock()
|
|
||||||
cc, ok := c.activeChains[targetChain]
|
|
||||||
c.RUnlock()
|
|
||||||
return cc, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// LookupChainByHash attempts to look up an active ChainControl which
|
|
||||||
// corresponds to the passed genesis hash.
|
|
||||||
func (c *ChainRegistry) LookupChainByHash(
|
|
||||||
chainHash chainhash.Hash) (*ChainControl, bool) {
|
|
||||||
|
|
||||||
c.RLock()
|
|
||||||
defer c.RUnlock()
|
|
||||||
|
|
||||||
targetChain, ok := chainMap[chainHash]
|
|
||||||
if !ok {
|
|
||||||
return nil, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
cc, ok := c.activeChains[targetChain]
|
|
||||||
return cc, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterPrimaryChain sets a target chain as the "home chain" for lnd.
|
|
||||||
func (c *ChainRegistry) RegisterPrimaryChain(cc ChainCode) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
|
|
||||||
c.primaryChain = cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrimaryChain returns the primary chain for this running lnd instance. The
|
|
||||||
// primary chain is considered the "home base" while the other registered
|
|
||||||
// chains are treated as secondary chains.
|
|
||||||
func (c *ChainRegistry) PrimaryChain() ChainCode {
|
|
||||||
c.RLock()
|
|
||||||
defer c.RUnlock()
|
|
||||||
|
|
||||||
return c.primaryChain
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActiveChains returns a slice containing the active chains.
|
|
||||||
func (c *ChainRegistry) ActiveChains() []ChainCode {
|
|
||||||
c.RLock()
|
|
||||||
defer c.RUnlock()
|
|
||||||
|
|
||||||
chains := make([]ChainCode, 0, len(c.activeChains))
|
|
||||||
for activeChain := range c.activeChains {
|
|
||||||
chains = append(chains, activeChain)
|
|
||||||
}
|
|
||||||
|
|
||||||
return chains
|
|
||||||
}
|
|
||||||
|
|
||||||
// NumActiveChains returns the total number of active chains.
|
|
||||||
func (c *ChainRegistry) NumActiveChains() uint32 {
|
|
||||||
c.RLock()
|
|
||||||
defer c.RUnlock()
|
|
||||||
|
|
||||||
return uint32(len(c.activeChains))
|
|
||||||
}
|
|
||||||
|
31
config.go
31
config.go
@ -225,6 +225,9 @@ const (
|
|||||||
// defaultGrpcClientPingMinWait is the default minimum amount of time a
|
// defaultGrpcClientPingMinWait is the default minimum amount of time a
|
||||||
// client should wait before sending a keepalive ping.
|
// client should wait before sending a keepalive ping.
|
||||||
defaultGrpcClientPingMinWait = 5 * time.Second
|
defaultGrpcClientPingMinWait = 5 * time.Second
|
||||||
|
|
||||||
|
// BitcoinChainName is a string that represents the Bitcoin blockchain.
|
||||||
|
BitcoinChainName = "bitcoin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -471,10 +474,6 @@ type Config struct {
|
|||||||
// hooked up to.
|
// hooked up to.
|
||||||
LogWriter *build.RotatingLogWriter
|
LogWriter *build.RotatingLogWriter
|
||||||
|
|
||||||
// registeredChains keeps track of all chains that have been registered
|
|
||||||
// with the daemon.
|
|
||||||
registeredChains *chainreg.ChainRegistry
|
|
||||||
|
|
||||||
// networkDir is the path to the directory of the currently active
|
// networkDir is the path to the directory of the currently active
|
||||||
// network. This path will hold the files related to each different
|
// network. This path will hold the files related to each different
|
||||||
// network.
|
// network.
|
||||||
@ -670,7 +669,6 @@ func DefaultConfig() Config {
|
|||||||
DB: lncfg.DefaultDB(),
|
DB: lncfg.DefaultDB(),
|
||||||
Cluster: lncfg.DefaultCluster(),
|
Cluster: lncfg.DefaultCluster(),
|
||||||
RPCMiddleware: lncfg.DefaultRPCMiddleware(),
|
RPCMiddleware: lncfg.DefaultRPCMiddleware(),
|
||||||
registeredChains: chainreg.NewChainRegistry(),
|
|
||||||
ActiveNetParams: chainreg.BitcoinTestNetParams,
|
ActiveNetParams: chainreg.BitcoinTestNetParams,
|
||||||
ChannelCommitInterval: defaultChannelCommitInterval,
|
ChannelCommitInterval: defaultChannelCommitInterval,
|
||||||
PendingCommitInterval: defaultPendingCommitInterval,
|
PendingCommitInterval: defaultPendingCommitInterval,
|
||||||
@ -1218,8 +1216,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
switch cfg.Bitcoin.Node {
|
switch cfg.Bitcoin.Node {
|
||||||
case "btcd":
|
case "btcd":
|
||||||
err := parseRPCParams(
|
err := parseRPCParams(
|
||||||
cfg.Bitcoin, cfg.BtcdMode,
|
cfg.Bitcoin, cfg.BtcdMode, cfg.ActiveNetParams,
|
||||||
chainreg.BitcoinChain, cfg.ActiveNetParams,
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mkErr("unable to load RPC "+
|
return nil, mkErr("unable to load RPC "+
|
||||||
@ -1232,8 +1229,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err := parseRPCParams(
|
err := parseRPCParams(
|
||||||
cfg.Bitcoin, cfg.BitcoindMode,
|
cfg.Bitcoin, cfg.BitcoindMode, cfg.ActiveNetParams,
|
||||||
chainreg.BitcoinChain, cfg.ActiveNetParams,
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mkErr("unable to load RPC "+
|
return nil, mkErr("unable to load RPC "+
|
||||||
@ -1253,14 +1249,9 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg.Bitcoin.ChainDir = filepath.Join(
|
cfg.Bitcoin.ChainDir = filepath.Join(
|
||||||
cfg.DataDir, defaultChainSubDirname,
|
cfg.DataDir, defaultChainSubDirname, BitcoinChainName,
|
||||||
chainreg.BitcoinChain.String(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Finally we'll register the bitcoin chain as our current
|
|
||||||
// primary chain.
|
|
||||||
cfg.registeredChains.RegisterPrimaryChain(chainreg.BitcoinChain)
|
|
||||||
|
|
||||||
// Ensure that the user didn't attempt to specify negative values for
|
// Ensure that the user didn't attempt to specify negative values for
|
||||||
// any of the autopilot params.
|
// any of the autopilot params.
|
||||||
if cfg.Autopilot.MaxChannels < 0 {
|
if cfg.Autopilot.MaxChannels < 0 {
|
||||||
@ -1317,8 +1308,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
// We'll now construct the network directory which will be where we
|
// We'll now construct the network directory which will be where we
|
||||||
// store all the data specific to this chain/network.
|
// store all the data specific to this chain/network.
|
||||||
cfg.networkDir = filepath.Join(
|
cfg.networkDir = filepath.Join(
|
||||||
cfg.DataDir, defaultChainSubDirname,
|
cfg.DataDir, defaultChainSubDirname, BitcoinChainName,
|
||||||
cfg.registeredChains.PrimaryChain().String(),
|
|
||||||
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1342,8 +1332,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
towerDir := filepath.Join(
|
towerDir := filepath.Join(
|
||||||
cfg.Watchtower.TowerDir,
|
cfg.Watchtower.TowerDir, BitcoinChainName,
|
||||||
cfg.registeredChains.PrimaryChain().String(),
|
|
||||||
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1376,7 +1365,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
// Append the network type to the log directory so it is "namespaced"
|
// Append the network type to the log directory so it is "namespaced"
|
||||||
// per network in the same fashion as the data directory.
|
// per network in the same fashion as the data directory.
|
||||||
cfg.LogDir = filepath.Join(
|
cfg.LogDir = filepath.Join(
|
||||||
cfg.LogDir, cfg.registeredChains.PrimaryChain().String(),
|
cfg.LogDir, BitcoinChainName,
|
||||||
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1753,7 +1742,7 @@ func CleanAndExpandPath(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseRPCParams(cConfig *lncfg.Chain, nodeConfig interface{},
|
func parseRPCParams(cConfig *lncfg.Chain, nodeConfig interface{},
|
||||||
net chainreg.ChainCode, netParams chainreg.BitcoinNetParams) error {
|
netParams chainreg.BitcoinNetParams) error {
|
||||||
|
|
||||||
// First, we'll check our node config to make sure the RPC parameters
|
// First, we'll check our node config to make sure the RPC parameters
|
||||||
// were set correctly. We'll also determine the path to the conf file
|
// were set correctly. We'll also determine the path to the conf file
|
||||||
|
@ -538,7 +538,6 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
|||||||
// replicated, so we'll pass in the remote channel DB instance.
|
// replicated, so we'll pass in the remote channel DB instance.
|
||||||
chainControlCfg := &chainreg.Config{
|
chainControlCfg := &chainreg.Config{
|
||||||
Bitcoin: d.cfg.Bitcoin,
|
Bitcoin: d.cfg.Bitcoin,
|
||||||
PrimaryChain: d.cfg.registeredChains.PrimaryChain,
|
|
||||||
HeightHintCacheQueryDisable: d.cfg.HeightHintCacheQueryDisable,
|
HeightHintCacheQueryDisable: d.cfg.HeightHintCacheQueryDisable,
|
||||||
NeutrinoMode: d.cfg.NeutrinoMode,
|
NeutrinoMode: d.cfg.NeutrinoMode,
|
||||||
BitcoindMode: d.cfg.BitcoindMode,
|
BitcoindMode: d.cfg.BitcoindMode,
|
||||||
@ -911,8 +910,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
|||||||
|
|
||||||
databaseBackends, err := cfg.DB.GetBackends(
|
databaseBackends, err := cfg.DB.GetBackends(
|
||||||
ctx, cfg.graphDatabaseDir(), cfg.networkDir, filepath.Join(
|
ctx, cfg.graphDatabaseDir(), cfg.networkDir, filepath.Join(
|
||||||
cfg.Watchtower.TowerDir,
|
cfg.Watchtower.TowerDir, BitcoinChainName,
|
||||||
cfg.registeredChains.PrimaryChain().String(),
|
|
||||||
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
lncfg.NormalizeNetwork(cfg.ActiveNetParams.Name),
|
||||||
), cfg.WtClient.Active, cfg.Watchtower.Active, d.logger,
|
), cfg.WtClient.Active, cfg.Watchtower.Active, d.logger,
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/chainreg"
|
|
||||||
"github.com/lightningnetwork/lnd/chanacceptor"
|
"github.com/lightningnetwork/lnd/chanacceptor"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||||
@ -518,10 +517,6 @@ type Config struct {
|
|||||||
// is enabled.
|
// is enabled.
|
||||||
EnableUpfrontShutdown bool
|
EnableUpfrontShutdown bool
|
||||||
|
|
||||||
// RegisteredChains keeps track of all chains that have been registered
|
|
||||||
// with the daemon.
|
|
||||||
RegisteredChains *chainreg.ChainRegistry
|
|
||||||
|
|
||||||
// MaxAnchorsCommitFeeRate is the max commitment fee rate we'll use as
|
// MaxAnchorsCommitFeeRate is the max commitment fee rate we'll use as
|
||||||
// the initiator for channels of the anchor type.
|
// the initiator for channels of the anchor type.
|
||||||
MaxAnchorsCommitFeeRate chainfee.SatPerKWeight
|
MaxAnchorsCommitFeeRate chainfee.SatPerKWeight
|
||||||
|
@ -549,7 +549,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
|||||||
NotifyOpenChannelEvent: evt.NotifyOpenChannelEvent,
|
NotifyOpenChannelEvent: evt.NotifyOpenChannelEvent,
|
||||||
OpenChannelPredicate: chainedAcceptor,
|
OpenChannelPredicate: chainedAcceptor,
|
||||||
NotifyPendingOpenChannelEvent: evt.NotifyPendingOpenChannelEvent,
|
NotifyPendingOpenChannelEvent: evt.NotifyPendingOpenChannelEvent,
|
||||||
RegisteredChains: chainreg.NewChainRegistry(),
|
|
||||||
DeleteAliasEdge: func(scid lnwire.ShortChannelID) (
|
DeleteAliasEdge: func(scid lnwire.ShortChannelID) (
|
||||||
*channeldb.ChannelEdgePolicy, error) {
|
*channeldb.ChannelEdgePolicy, error) {
|
||||||
|
|
||||||
|
9
lnd.go
9
lnd.go
@ -177,8 +177,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ltndLog.Infof("Active chain: %v (network=%v)",
|
ltndLog.Infof("Active chain: %v (network=%v)",
|
||||||
strings.Title(cfg.registeredChains.PrimaryChain().String()),
|
strings.Title(BitcoinChainName), network,
|
||||||
network,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@ -453,12 +452,6 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||||||
|
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
// Finally before we start the server, we'll register the "holy
|
|
||||||
// trinity" of interface for our current "home chain" with the active
|
|
||||||
// chainRegistry interface.
|
|
||||||
primaryChain := cfg.registeredChains.PrimaryChain()
|
|
||||||
cfg.registeredChains.RegisterChain(primaryChain, activeChainControl)
|
|
||||||
|
|
||||||
// TODO(roasbeef): add rotation
|
// TODO(roasbeef): add rotation
|
||||||
idKeyDesc, err := activeChainControl.KeyRing.DeriveKey(
|
idKeyDesc, err := activeChainControl.KeyRing.DeriveKey(
|
||||||
keychain.KeyLocator{
|
keychain.KeyLocator{
|
||||||
|
@ -2955,12 +2955,11 @@ func (r *rpcServer) GetInfo(_ context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
network := lncfg.NormalizeNetwork(r.cfg.ActiveNetParams.Name)
|
network := lncfg.NormalizeNetwork(r.cfg.ActiveNetParams.Name)
|
||||||
activeChains := make([]*lnrpc.Chain, r.cfg.registeredChains.NumActiveChains())
|
activeChains := []*lnrpc.Chain{
|
||||||
for i, chain := range r.cfg.registeredChains.ActiveChains() {
|
{
|
||||||
activeChains[i] = &lnrpc.Chain{
|
Chain: BitcoinChainName,
|
||||||
Chain: chain.String(),
|
|
||||||
Network: network,
|
Network: network,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if external IP addresses were provided to lnd and use them
|
// Check if external IP addresses were provided to lnd and use them
|
||||||
|
@ -1447,7 +1447,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
OpenChannelPredicate: chanPredicate,
|
OpenChannelPredicate: chanPredicate,
|
||||||
NotifyPendingOpenChannelEvent: s.channelNotifier.NotifyPendingOpenChannelEvent,
|
NotifyPendingOpenChannelEvent: s.channelNotifier.NotifyPendingOpenChannelEvent,
|
||||||
EnableUpfrontShutdown: cfg.EnableUpfrontShutdown,
|
EnableUpfrontShutdown: cfg.EnableUpfrontShutdown,
|
||||||
RegisteredChains: cfg.registeredChains,
|
|
||||||
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(
|
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(
|
||||||
s.cfg.MaxCommitFeeRateAnchors * 1000).FeePerKWeight(),
|
s.cfg.MaxCommitFeeRateAnchors * 1000).FeePerKWeight(),
|
||||||
DeleteAliasEdge: deleteAliasEdge,
|
DeleteAliasEdge: deleteAliasEdge,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user