mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
multi: remove Litecoin config options
This commit removes the `Litecoin`, `LtcMode` and `LitecoindMode` members from the main LND `Config` struct. Since only the bitcoin blockchain is now supported, this commit also deprecates the `cfg.Bitcoin.Active` config option.
This commit is contained in:
parent
ba93cde07a
commit
3912d5a0c6
@ -1,12 +1,9 @@
|
||||
package chainreg
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
bitcoinWire "github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
|
||||
litecoinWire "github.com/ltcsuite/ltcd/wire"
|
||||
)
|
||||
|
||||
@ -18,14 +15,6 @@ type BitcoinNetParams struct {
|
||||
CoinType uint32
|
||||
}
|
||||
|
||||
// LitecoinNetParams couples the p2p parameters of a network with the
|
||||
// corresponding RPC port of a daemon running on the particular network.
|
||||
type LitecoinNetParams struct {
|
||||
*litecoinCfg.Params
|
||||
RPCPort string
|
||||
CoinType uint32
|
||||
}
|
||||
|
||||
// BitcoinTestNetParams contains parameters specific to the 3rd version of the
|
||||
// test network.
|
||||
var BitcoinTestNetParams = BitcoinNetParams{
|
||||
@ -57,38 +46,6 @@ var BitcoinSigNetParams = BitcoinNetParams{
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
}
|
||||
|
||||
// LitecoinSimNetParams contains parameters specific to the simulation test
|
||||
// network.
|
||||
var LitecoinSimNetParams = LitecoinNetParams{
|
||||
Params: &litecoinCfg.TestNet4Params,
|
||||
RPCPort: "18556",
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
}
|
||||
|
||||
// LitecoinTestNetParams contains parameters specific to the 4th version of the
|
||||
// test network.
|
||||
var LitecoinTestNetParams = LitecoinNetParams{
|
||||
Params: &litecoinCfg.TestNet4Params,
|
||||
RPCPort: "19334",
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
}
|
||||
|
||||
// LitecoinMainNetParams contains the parameters specific to the current
|
||||
// Litecoin mainnet.
|
||||
var LitecoinMainNetParams = LitecoinNetParams{
|
||||
Params: &litecoinCfg.MainNetParams,
|
||||
RPCPort: "9334",
|
||||
CoinType: keychain.CoinTypeLitecoin,
|
||||
}
|
||||
|
||||
// LitecoinRegTestNetParams contains parameters specific to a local litecoin
|
||||
// regtest network.
|
||||
var LitecoinRegTestNetParams = LitecoinNetParams{
|
||||
Params: &litecoinCfg.RegressionNetParams,
|
||||
RPCPort: "18334",
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
}
|
||||
|
||||
// BitcoinRegTestNetParams contains parameters specific to a local bitcoin
|
||||
// regtest network.
|
||||
var BitcoinRegTestNetParams = BitcoinNetParams{
|
||||
@ -97,49 +54,6 @@ var BitcoinRegTestNetParams = BitcoinNetParams{
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
}
|
||||
|
||||
// ApplyLitecoinParams applies the relevant chain configuration parameters that
|
||||
// differ for litecoin to the chain parameters typed for btcsuite derivation.
|
||||
// This function is used in place of using something like interface{} to
|
||||
// abstract over _which_ chain (or fork) the parameters are for.
|
||||
func ApplyLitecoinParams(params *BitcoinNetParams,
|
||||
litecoinParams *LitecoinNetParams) {
|
||||
|
||||
params.Name = litecoinParams.Name
|
||||
params.Net = bitcoinWire.BitcoinNet(litecoinParams.Net)
|
||||
params.DefaultPort = litecoinParams.DefaultPort
|
||||
params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity
|
||||
|
||||
copy(params.GenesisHash[:], litecoinParams.GenesisHash[:])
|
||||
|
||||
// Address encoding magics
|
||||
params.PubKeyHashAddrID = litecoinParams.PubKeyHashAddrID
|
||||
params.ScriptHashAddrID = litecoinParams.ScriptHashAddrID
|
||||
params.PrivateKeyID = litecoinParams.PrivateKeyID
|
||||
params.WitnessPubKeyHashAddrID = litecoinParams.WitnessPubKeyHashAddrID
|
||||
params.WitnessScriptHashAddrID = litecoinParams.WitnessScriptHashAddrID
|
||||
params.Bech32HRPSegwit = litecoinParams.Bech32HRPSegwit
|
||||
|
||||
copy(params.HDPrivateKeyID[:], litecoinParams.HDPrivateKeyID[:])
|
||||
copy(params.HDPublicKeyID[:], litecoinParams.HDPublicKeyID[:])
|
||||
|
||||
params.HDCoinType = litecoinParams.HDCoinType
|
||||
|
||||
checkPoints := make([]chaincfg.Checkpoint, len(litecoinParams.Checkpoints))
|
||||
for i := 0; i < len(litecoinParams.Checkpoints); i++ {
|
||||
var chainHash chainhash.Hash
|
||||
copy(chainHash[:], litecoinParams.Checkpoints[i].Hash[:])
|
||||
|
||||
checkPoints[i] = chaincfg.Checkpoint{
|
||||
Height: litecoinParams.Checkpoints[i].Height,
|
||||
Hash: &chainHash,
|
||||
}
|
||||
}
|
||||
params.Checkpoints = checkPoints
|
||||
|
||||
params.RPCPort = litecoinParams.RPCPort
|
||||
params.CoinType = litecoinParams.CoinType
|
||||
}
|
||||
|
||||
// IsTestnet tests if the givern params correspond to a testnet
|
||||
// parameter configuration.
|
||||
func IsTestnet(params *BitcoinNetParams) bool {
|
||||
|
@ -130,11 +130,6 @@ const (
|
||||
// delta.
|
||||
DefaultBitcoinTimeLockDelta = 80
|
||||
|
||||
DefaultLitecoinMinHTLCInMSat = lnwire.MilliSatoshi(1)
|
||||
DefaultLitecoinMinHTLCOutMSat = lnwire.MilliSatoshi(1000)
|
||||
DefaultLitecoinBaseFeeMSat = lnwire.MilliSatoshi(1000)
|
||||
DefaultLitecoinFeeRate = lnwire.MilliSatoshi(1)
|
||||
DefaultLitecoinTimeLockDelta = 576
|
||||
DefaultLitecoinDustLimit = btcutil.Amount(54600)
|
||||
|
||||
// DefaultBitcoinStaticFeePerKW is the fee rate of 50 sat/vbyte
|
||||
@ -148,10 +143,6 @@ const (
|
||||
// DefaultLitecoinStaticFeePerKW is the fee rate of 200 sat/vbyte
|
||||
// expressed in sat/kw.
|
||||
DefaultLitecoinStaticFeePerKW = chainfee.SatPerKWeight(50000)
|
||||
|
||||
// BtcToLtcConversionRate is a fixed ratio used in order to scale up
|
||||
// payments when running on the Litecoin chain.
|
||||
BtcToLtcConversionRate = 60
|
||||
)
|
||||
|
||||
// DefaultLtcChannelConstraints is the default set of channel constraints that
|
||||
@ -355,13 +346,8 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
}
|
||||
|
||||
case "bitcoind", "litecoind":
|
||||
var bitcoindMode *lncfg.Bitcoind
|
||||
switch {
|
||||
case cfg.Bitcoin.Active:
|
||||
bitcoindMode = cfg.BitcoindMode
|
||||
case cfg.Litecoin.Active:
|
||||
bitcoindMode = cfg.LitecoindMode
|
||||
}
|
||||
bitcoindMode := cfg.BitcoindMode
|
||||
|
||||
// Otherwise, we'll be speaking directly via RPC and ZMQ to a
|
||||
// bitcoind node. If the specified host for the btcd/ltcd RPC
|
||||
// server already has a port specified, then we use that
|
||||
@ -617,14 +603,10 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
// connection. If a raw cert was specified in the config, then
|
||||
// we'll set that directly. Otherwise, we attempt to read the
|
||||
// cert from the path specified in the config.
|
||||
var btcdMode *lncfg.Btcd
|
||||
switch {
|
||||
case cfg.Bitcoin.Active:
|
||||
var (
|
||||
rpcCert []byte
|
||||
btcdMode = cfg.BtcdMode
|
||||
case cfg.Litecoin.Active:
|
||||
btcdMode = cfg.LtcdMode
|
||||
}
|
||||
var rpcCert []byte
|
||||
)
|
||||
if btcdMode.RawRPCCert != "" {
|
||||
rpcCert, err = hex.DecodeString(btcdMode.RawRPCCert)
|
||||
if err != nil {
|
||||
|
152
config.go
152
config.go
@ -252,11 +252,7 @@ var (
|
||||
defaultBtcdDir = btcutil.AppDataDir("btcd", false)
|
||||
defaultBtcdRPCCertFile = filepath.Join(defaultBtcdDir, "rpc.cert")
|
||||
|
||||
defaultLtcdDir = btcutil.AppDataDir("ltcd", false)
|
||||
defaultLtcdRPCCertFile = filepath.Join(defaultLtcdDir, "rpc.cert")
|
||||
|
||||
defaultBitcoindDir = btcutil.AppDataDir("bitcoin", false)
|
||||
defaultLitecoindDir = btcutil.AppDataDir("litecoin", false)
|
||||
|
||||
defaultTorSOCKS = net.JoinHostPort("localhost", strconv.Itoa(defaultTorSOCKSPort))
|
||||
defaultTorDNS = net.JoinHostPort(defaultTorDNSHost, strconv.Itoa(defaultTorDNSPort))
|
||||
@ -352,10 +348,6 @@ type Config struct {
|
||||
BitcoindMode *lncfg.Bitcoind `group:"bitcoind" namespace:"bitcoind"`
|
||||
NeutrinoMode *lncfg.Neutrino `group:"neutrino" namespace:"neutrino"`
|
||||
|
||||
Litecoin *lncfg.Chain `group:"Litecoin" namespace:"litecoin"`
|
||||
LtcdMode *lncfg.Btcd `group:"ltcd" namespace:"ltcd"`
|
||||
LitecoindMode *lncfg.Bitcoind `group:"litecoind" namespace:"litecoind"`
|
||||
|
||||
BlockCacheSize uint64 `long:"blockcachesize" description:"The maximum capacity of the block cache"`
|
||||
|
||||
Autopilot *lncfg.AutoPilot `group:"Autopilot" namespace:"autopilot"`
|
||||
@ -569,26 +561,6 @@ func DefaultConfig() Config {
|
||||
PrunedNodeMaxPeers: defaultPrunedNodeMaxPeers,
|
||||
ZMQReadDeadline: defaultZMQReadDeadline,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{
|
||||
MinHTLCIn: chainreg.DefaultLitecoinMinHTLCInMSat,
|
||||
MinHTLCOut: chainreg.DefaultLitecoinMinHTLCOutMSat,
|
||||
BaseFee: chainreg.DefaultLitecoinBaseFeeMSat,
|
||||
FeeRate: chainreg.DefaultLitecoinFeeRate,
|
||||
TimeLockDelta: chainreg.DefaultLitecoinTimeLockDelta,
|
||||
MaxLocalDelay: defaultMaxLocalCSVDelay,
|
||||
Node: "ltcd",
|
||||
},
|
||||
LtcdMode: &lncfg.Btcd{
|
||||
Dir: defaultLtcdDir,
|
||||
RPCHost: defaultRPCHost,
|
||||
RPCCert: defaultLtcdRPCCertFile,
|
||||
},
|
||||
LitecoindMode: &lncfg.Bitcoind{
|
||||
Dir: defaultLitecoindDir,
|
||||
RPCHost: defaultRPCHost,
|
||||
EstimateMode: defaultBitcoindEstimateMode,
|
||||
PrunedNodeMaxPeers: defaultPrunedNodeMaxPeers,
|
||||
},
|
||||
NeutrinoMode: &lncfg.Neutrino{
|
||||
UserAgentName: neutrino.UserAgentName,
|
||||
UserAgentVersion: neutrino.UserAgentVersion,
|
||||
@ -949,19 +921,11 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
cfg.InvoiceMacPath = CleanAndExpandPath(cfg.InvoiceMacPath)
|
||||
cfg.LogDir = CleanAndExpandPath(cfg.LogDir)
|
||||
cfg.BtcdMode.Dir = CleanAndExpandPath(cfg.BtcdMode.Dir)
|
||||
cfg.LtcdMode.Dir = CleanAndExpandPath(cfg.LtcdMode.Dir)
|
||||
cfg.BitcoindMode.Dir = CleanAndExpandPath(cfg.BitcoindMode.Dir)
|
||||
cfg.BitcoindMode.ConfigPath = CleanAndExpandPath(
|
||||
cfg.BitcoindMode.ConfigPath,
|
||||
)
|
||||
cfg.BitcoindMode.RPCCookie = CleanAndExpandPath(cfg.BitcoindMode.RPCCookie)
|
||||
cfg.LitecoindMode.Dir = CleanAndExpandPath(cfg.LitecoindMode.Dir)
|
||||
cfg.LitecoindMode.ConfigPath = CleanAndExpandPath(
|
||||
cfg.LitecoindMode.ConfigPath,
|
||||
)
|
||||
cfg.LitecoindMode.RPCCookie = CleanAndExpandPath(
|
||||
cfg.LitecoindMode.RPCCookie,
|
||||
)
|
||||
cfg.Tor.PrivateKeyPath = CleanAndExpandPath(cfg.Tor.PrivateKeyPath)
|
||||
cfg.Tor.WatchtowerKeyPath = CleanAndExpandPath(cfg.Tor.WatchtowerKeyPath)
|
||||
cfg.Watchtower.TowerDir = CleanAndExpandPath(cfg.Watchtower.TowerDir)
|
||||
@ -1162,114 +1126,6 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
"mutually exclusive, only one should be selected")
|
||||
}
|
||||
|
||||
// Determine the active chain configuration and its parameters.
|
||||
switch {
|
||||
// At this moment, multiple active chains are not supported.
|
||||
case cfg.Litecoin.Active && cfg.Bitcoin.Active:
|
||||
str := "Currently both Bitcoin and Litecoin cannot be " +
|
||||
"active together"
|
||||
return nil, mkErr(str)
|
||||
|
||||
// Either Bitcoin must be active, or Litecoin must be active.
|
||||
// Otherwise, we don't know which chain we're on.
|
||||
case !cfg.Bitcoin.Active && !cfg.Litecoin.Active:
|
||||
return nil, mkErr("either bitcoin.active or " +
|
||||
"litecoin.active must be set to 1 (true)")
|
||||
|
||||
case cfg.Litecoin.Active:
|
||||
err := cfg.Litecoin.Validate(
|
||||
minTimeLockDelta, funding.MinLtcRemoteDelay,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, mkErr("error validating litecoin: %v", err)
|
||||
}
|
||||
|
||||
// Multiple networks can't be selected simultaneously. Count
|
||||
// number of network flags passed; assign active network params
|
||||
// while we're at it.
|
||||
numNets := 0
|
||||
var ltcParams chainreg.LitecoinNetParams
|
||||
if cfg.Litecoin.MainNet {
|
||||
numNets++
|
||||
ltcParams = chainreg.LitecoinMainNetParams
|
||||
}
|
||||
if cfg.Litecoin.TestNet3 {
|
||||
numNets++
|
||||
ltcParams = chainreg.LitecoinTestNetParams
|
||||
}
|
||||
if cfg.Litecoin.RegTest {
|
||||
numNets++
|
||||
ltcParams = chainreg.LitecoinRegTestNetParams
|
||||
}
|
||||
if cfg.Litecoin.SimNet {
|
||||
numNets++
|
||||
ltcParams = chainreg.LitecoinSimNetParams
|
||||
}
|
||||
if cfg.Litecoin.SigNet {
|
||||
return nil, mkErr("litecoin.signet is not supported")
|
||||
}
|
||||
|
||||
if numNets > 1 {
|
||||
str := "The mainnet, testnet, and simnet params " +
|
||||
"can't be used together -- choose one of the " +
|
||||
"three"
|
||||
return nil, mkErr(str)
|
||||
}
|
||||
|
||||
// The target network must be provided, otherwise, we won't
|
||||
// know how to initialize the daemon.
|
||||
if numNets == 0 {
|
||||
str := "either --litecoin.mainnet, or " +
|
||||
"litecoin.testnet must be specified"
|
||||
return nil, mkErr(str)
|
||||
}
|
||||
|
||||
// The litecoin chain is the current active chain. However
|
||||
// throughout the codebase we required chaincfg.Params. So as a
|
||||
// temporary hack, we'll mutate the default net params for
|
||||
// bitcoin with the litecoin specific information.
|
||||
chainreg.ApplyLitecoinParams(&cfg.ActiveNetParams, <cParams)
|
||||
|
||||
switch cfg.Litecoin.Node {
|
||||
case "ltcd":
|
||||
err := parseRPCParams(
|
||||
cfg.Litecoin, cfg.LtcdMode,
|
||||
chainreg.LitecoinChain, cfg.ActiveNetParams,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, mkErr("unable to load RPC "+
|
||||
"credentials for ltcd: %v", err)
|
||||
}
|
||||
case "litecoind":
|
||||
if cfg.Litecoin.SimNet {
|
||||
return nil, mkErr("litecoind does not " +
|
||||
"support simnet")
|
||||
}
|
||||
err := parseRPCParams(
|
||||
cfg.Litecoin, cfg.LitecoindMode,
|
||||
chainreg.LitecoinChain, cfg.ActiveNetParams,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, mkErr("unable to load RPC "+
|
||||
"credentials for litecoind: %v", err)
|
||||
}
|
||||
default:
|
||||
str := "only ltcd and litecoind mode supported for " +
|
||||
"litecoin at this time"
|
||||
return nil, mkErr(str)
|
||||
}
|
||||
|
||||
cfg.Litecoin.ChainDir = filepath.Join(
|
||||
cfg.DataDir, defaultChainSubDirname,
|
||||
chainreg.LitecoinChain.String(),
|
||||
)
|
||||
|
||||
// Finally, we'll register the litecoin chain as our current
|
||||
// primary chain.
|
||||
cfg.registeredChains.RegisterPrimaryChain(chainreg.LitecoinChain)
|
||||
MaxFundingAmount = funding.MaxLtcFundingAmount
|
||||
|
||||
case cfg.Bitcoin.Active:
|
||||
// Multiple networks can't be selected simultaneously. Count
|
||||
// number of network flags passed; assign active network params
|
||||
// while we're at it.
|
||||
@ -1354,12 +1210,9 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
return nil, mkErr(str)
|
||||
}
|
||||
|
||||
err := cfg.Bitcoin.Validate(
|
||||
minTimeLockDelta, funding.MinBtcRemoteDelay,
|
||||
)
|
||||
err = cfg.Bitcoin.Validate(minTimeLockDelta, funding.MinBtcRemoteDelay)
|
||||
if err != nil {
|
||||
return nil, mkErr("error validating bitcoin params: %v",
|
||||
err)
|
||||
return nil, mkErr("error validating bitcoin params: %v", err)
|
||||
}
|
||||
|
||||
switch cfg.Bitcoin.Node {
|
||||
@ -1407,7 +1260,6 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
// 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
|
||||
// any of the autopilot params.
|
||||
|
@ -257,9 +257,6 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
||||
// light client instance, if enabled, in order to allow it to sync
|
||||
// while the rest of the daemon continues startup.
|
||||
mainChain := d.cfg.Bitcoin
|
||||
if d.cfg.registeredChains.PrimaryChain() == chainreg.LitecoinChain {
|
||||
mainChain = d.cfg.Litecoin
|
||||
}
|
||||
var neutrinoCS *neutrino.ChainService
|
||||
if mainChain.Node == "neutrino" {
|
||||
neutrinoBackend, neutrinoCleanUp, err := initNeutrinoBackend(
|
||||
@ -541,14 +538,11 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
||||
// replicated, so we'll pass in the remote channel DB instance.
|
||||
chainControlCfg := &chainreg.Config{
|
||||
Bitcoin: d.cfg.Bitcoin,
|
||||
Litecoin: d.cfg.Litecoin,
|
||||
PrimaryChain: d.cfg.registeredChains.PrimaryChain,
|
||||
HeightHintCacheQueryDisable: d.cfg.HeightHintCacheQueryDisable,
|
||||
NeutrinoMode: d.cfg.NeutrinoMode,
|
||||
BitcoindMode: d.cfg.BitcoindMode,
|
||||
LitecoindMode: d.cfg.LitecoindMode,
|
||||
BtcdMode: d.cfg.BtcdMode,
|
||||
LtcdMode: d.cfg.LtcdMode,
|
||||
HeightHintDB: dbs.HeightHintDB,
|
||||
ChanStateDB: dbs.ChanStateDB.ChannelStateDB(),
|
||||
NeutrinoCS: neutrinoCS,
|
||||
|
@ -74,14 +74,6 @@ const (
|
||||
// to use for its commitment transaction.
|
||||
MaxBtcRemoteDelay uint16 = 2016
|
||||
|
||||
// MinLtcRemoteDelay is the minimum Litecoin CSV delay we will require
|
||||
// the remote to use for its commitment transaction.
|
||||
MinLtcRemoteDelay uint16 = 576
|
||||
|
||||
// MaxLtcRemoteDelay is the maximum Litecoin CSV delay we will require
|
||||
// the remote to use for its commitment transaction.
|
||||
MaxLtcRemoteDelay uint16 = 8064
|
||||
|
||||
// MinChanFundingSize is the smallest channel that we'll allow to be
|
||||
// created over the RPC interface.
|
||||
MinChanFundingSize = btcutil.Amount(20000)
|
||||
@ -98,12 +90,6 @@ const (
|
||||
// you and limitless channel size (apart from 21 million cap).
|
||||
MaxBtcFundingAmountWumbo = btcutil.Amount(1000000000)
|
||||
|
||||
// MaxLtcFundingAmount is a soft-limit of the maximum channel size
|
||||
// currently accepted on the Litecoin chain within the Lightning
|
||||
// Protocol.
|
||||
MaxLtcFundingAmount = MaxBtcFundingAmount *
|
||||
chainreg.BtcToLtcConversionRate
|
||||
|
||||
// TODO(roasbeef): tune.
|
||||
msgBufferSize = 50
|
||||
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
//
|
||||
//nolint:lll
|
||||
type Chain struct {
|
||||
Active bool `long:"active" description:"If the chain should be active or not."`
|
||||
Active bool `long:"active" description:"DEPRECATED: If the chain should be active or not. This field is now ignored since only the Bitcoin chain is supported"`
|
||||
ChainDir string `long:"chaindir" description:"The directory to store the chain's data within."`
|
||||
|
||||
Node string `long:"node" description:"The blockchain interface to use." choice:"btcd" choice:"bitcoind" choice:"neutrino" choice:"ltcd" choice:"litecoind" choice:"nochainbackend"`
|
||||
|
8
lnd.go
8
lnd.go
@ -160,16 +160,16 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
||||
|
||||
var network string
|
||||
switch {
|
||||
case cfg.Bitcoin.TestNet3 || cfg.Litecoin.TestNet3:
|
||||
case cfg.Bitcoin.TestNet3:
|
||||
network = "testnet"
|
||||
|
||||
case cfg.Bitcoin.MainNet || cfg.Litecoin.MainNet:
|
||||
case cfg.Bitcoin.MainNet:
|
||||
network = "mainnet"
|
||||
|
||||
case cfg.Bitcoin.SimNet || cfg.Litecoin.SimNet:
|
||||
case cfg.Bitcoin.SimNet:
|
||||
network = "simnet"
|
||||
|
||||
case cfg.Bitcoin.RegTest || cfg.Litecoin.RegTest:
|
||||
case cfg.Bitcoin.RegTest:
|
||||
network = "regtest"
|
||||
|
||||
case cfg.Bitcoin.SigNet:
|
||||
|
@ -5570,9 +5570,6 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
|
||||
invoice *lnrpc.Invoice) (*lnrpc.AddInvoiceResponse, error) {
|
||||
|
||||
defaultDelta := r.cfg.Bitcoin.TimeLockDelta
|
||||
if r.cfg.registeredChains.PrimaryChain() == chainreg.LitecoinChain {
|
||||
defaultDelta = r.cfg.Litecoin.TimeLockDelta
|
||||
}
|
||||
|
||||
addInvoiceCfg := &invoicesrpc.AddInvoiceConfig{
|
||||
AddInvoice: r.server.invoices.AddInvoice,
|
||||
|
@ -542,8 +542,8 @@
|
||||
|
||||
[Bitcoin]
|
||||
|
||||
; If the Bitcoin chain should be active. Atm, only a single chain can be
|
||||
; active.
|
||||
; DEPRECATED: If the Bitcoin chain should be active. This field is now ignored
|
||||
; since only the Bitcoin chain is supported.
|
||||
; bitcoin.active=false
|
||||
|
||||
; The directory to store the chain's data within.
|
||||
|
32
server.go
32
server.go
@ -1220,17 +1220,10 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
HtlcNotifier: s.htlcNotifier,
|
||||
}, dbs.ChanStateDB)
|
||||
|
||||
// Select the configuration and furnding parameters for Bitcoin or
|
||||
// Litecoin, depending on the primary registered chain.
|
||||
primaryChain := cfg.registeredChains.PrimaryChain()
|
||||
// Select the configuration and funding parameters for Bitcoin.
|
||||
chainCfg := cfg.Bitcoin
|
||||
minRemoteDelay := funding.MinBtcRemoteDelay
|
||||
maxRemoteDelay := funding.MaxBtcRemoteDelay
|
||||
if primaryChain == chainreg.LitecoinChain {
|
||||
chainCfg = cfg.Litecoin
|
||||
minRemoteDelay = funding.MinLtcRemoteDelay
|
||||
maxRemoteDelay = funding.MaxLtcRemoteDelay
|
||||
}
|
||||
|
||||
var chanIDSeed [32]byte
|
||||
if _, err := rand.Read(chanIDSeed[:]); err != nil {
|
||||
@ -2182,32 +2175,25 @@ func (s *server) Start() error {
|
||||
}
|
||||
|
||||
// Let users overwrite the DNS seed nodes. We only allow them
|
||||
// for bitcoin mainnet/testnet and litecoin mainnet, all other
|
||||
// combinations will just be ignored.
|
||||
if s.cfg.Bitcoin.Active && s.cfg.Bitcoin.MainNet {
|
||||
// for bitcoin mainnet/testnet/signet.
|
||||
if s.cfg.Bitcoin.MainNet {
|
||||
setSeedList(
|
||||
s.cfg.Bitcoin.DNSSeeds,
|
||||
chainreg.BitcoinMainnetGenesis,
|
||||
)
|
||||
}
|
||||
if s.cfg.Bitcoin.Active && s.cfg.Bitcoin.TestNet3 {
|
||||
if s.cfg.Bitcoin.TestNet3 {
|
||||
setSeedList(
|
||||
s.cfg.Bitcoin.DNSSeeds,
|
||||
chainreg.BitcoinTestnetGenesis,
|
||||
)
|
||||
}
|
||||
if s.cfg.Bitcoin.Active && s.cfg.Bitcoin.SigNet {
|
||||
if s.cfg.Bitcoin.SigNet {
|
||||
setSeedList(
|
||||
s.cfg.Bitcoin.DNSSeeds,
|
||||
chainreg.BitcoinSignetGenesis,
|
||||
)
|
||||
}
|
||||
if s.cfg.Litecoin.Active && s.cfg.Litecoin.MainNet {
|
||||
setSeedList(
|
||||
s.cfg.Litecoin.DNSSeeds,
|
||||
chainreg.LitecoinMainnetGenesis,
|
||||
)
|
||||
}
|
||||
|
||||
// If network bootstrapping hasn't been disabled, then we'll
|
||||
// configure the set of active bootstrappers, and launch a
|
||||
@ -2559,7 +2545,7 @@ func initNetworkBootstrappers(s *server) ([]discovery.NetworkPeerBootstrapper, e
|
||||
|
||||
// If this isn't simnet mode, then one of our additional bootstrapping
|
||||
// sources will be the set of running DNS seeds.
|
||||
if !s.cfg.Bitcoin.SimNet || !s.cfg.Litecoin.SimNet {
|
||||
if !s.cfg.Bitcoin.SimNet {
|
||||
dnsSeeds, ok := chainreg.ChainDNSSeeds[*s.cfg.ActiveNetParams.GenesisHash]
|
||||
|
||||
// If we have a set of DNS seeds for this chain, then we'll add
|
||||
@ -4713,9 +4699,9 @@ func newSweepPkScriptGen(
|
||||
// bootstrapping to actively seek our peers using the set of active network
|
||||
// bootstrappers.
|
||||
func shouldPeerBootstrap(cfg *Config) bool {
|
||||
isSimnet := (cfg.Bitcoin.SimNet || cfg.Litecoin.SimNet)
|
||||
isSignet := (cfg.Bitcoin.SigNet || cfg.Litecoin.SigNet)
|
||||
isRegtest := (cfg.Bitcoin.RegTest || cfg.Litecoin.RegTest)
|
||||
isSimnet := cfg.Bitcoin.SimNet
|
||||
isSignet := cfg.Bitcoin.SigNet
|
||||
isRegtest := cfg.Bitcoin.RegTest
|
||||
isDevNetwork := isSimnet || isSignet || isRegtest
|
||||
|
||||
// TODO(yy): remove the check on simnet/regtest such that the itest is
|
||||
|
@ -21,7 +21,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
SimNet: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
},
|
||||
},
|
||||
|
||||
@ -31,7 +30,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
RegTest: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
},
|
||||
},
|
||||
|
||||
@ -41,7 +39,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
SigNet: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
},
|
||||
},
|
||||
|
||||
@ -51,7 +48,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
MainNet: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
NoNetBootstrap: true,
|
||||
},
|
||||
},
|
||||
@ -62,7 +58,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
MainNet: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
},
|
||||
shouldBoostrap: true,
|
||||
},
|
||||
@ -73,7 +68,6 @@ func TestShouldPeerBootstrap(t *testing.T) {
|
||||
Bitcoin: &lncfg.Chain{
|
||||
TestNet3: true,
|
||||
},
|
||||
Litecoin: &lncfg.Chain{},
|
||||
},
|
||||
shouldBoostrap: true,
|
||||
},
|
||||
|
@ -244,9 +244,6 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
|
||||
reflect.ValueOf(nodeSigner),
|
||||
)
|
||||
defaultDelta := cfg.Bitcoin.TimeLockDelta
|
||||
if cfg.registeredChains.PrimaryChain() == chainreg.LitecoinChain {
|
||||
defaultDelta = cfg.Litecoin.TimeLockDelta
|
||||
}
|
||||
subCfgValue.FieldByName("DefaultCLTVExpiry").Set(
|
||||
reflect.ValueOf(defaultDelta),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user