add litecoin regtest configuration to lnd
regtest change to chainregistry for default port number merge w/ master
This commit is contained in:
parent
42b081bb37
commit
6fd5ef88b6
@ -78,8 +78,17 @@ var litecoinMainNetParams = litecoinNetParams{
|
|||||||
CoinType: keychain.CoinTypeLitecoin,
|
CoinType: keychain.CoinTypeLitecoin,
|
||||||
}
|
}
|
||||||
|
|
||||||
// regTestNetParams contains parameters specific to a local regtest network.
|
// litecoinRegTestNetParams contains parameters specific to a local litecoin
|
||||||
var regTestNetParams = bitcoinNetParams{
|
// 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{
|
||||||
Params: &bitcoinCfg.RegressionNetParams,
|
Params: &bitcoinCfg.RegressionNetParams,
|
||||||
rpcPort: "18334",
|
rpcPort: "18334",
|
||||||
CoinType: keychain.CoinTypeTestnet,
|
CoinType: keychain.CoinTypeTestnet,
|
||||||
|
@ -256,10 +256,15 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
|||||||
rpcPort -= 2
|
rpcPort -= 2
|
||||||
bitcoindHost = fmt.Sprintf("%v:%d",
|
bitcoindHost = fmt.Sprintf("%v:%d",
|
||||||
bitcoindMode.RPCHost, rpcPort)
|
bitcoindMode.RPCHost, rpcPort)
|
||||||
if cfg.Bitcoin.Active && cfg.Bitcoin.RegTest {
|
if (cfg.Bitcoin.Active && cfg.Bitcoin.RegTest) ||
|
||||||
|
(cfg.Litecoin.Active && cfg.Litecoin.RegTest) {
|
||||||
conn, err := net.Dial("tcp", bitcoindHost)
|
conn, err := net.Dial("tcp", bitcoindHost)
|
||||||
if err != nil || conn == nil {
|
if err != nil || conn == nil {
|
||||||
|
if cfg.Bitcoin.Active && cfg.Bitcoin.RegTest {
|
||||||
rpcPort = 18443
|
rpcPort = 18443
|
||||||
|
} else if cfg.Litecoin.Active && cfg.Litecoin.RegTest {
|
||||||
|
rpcPort = 19443
|
||||||
|
}
|
||||||
bitcoindHost = fmt.Sprintf("%v:%d",
|
bitcoindHost = fmt.Sprintf("%v:%d",
|
||||||
bitcoindMode.RPCHost,
|
bitcoindMode.RPCHost,
|
||||||
rpcPort)
|
rpcPort)
|
||||||
@ -320,7 +325,7 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
|||||||
if err := cc.feeEstimator.Start(); err != nil {
|
if err := cc.feeEstimator.Start(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else if cfg.Litecoin.Active {
|
} else if cfg.Litecoin.Active && !cfg.Litecoin.RegTest {
|
||||||
ltndLog.Infof("Initializing litecoind backed fee estimator")
|
ltndLog.Infof("Initializing litecoind backed fee estimator")
|
||||||
|
|
||||||
// Finally, we'll re-initialize the fee estimator, as
|
// Finally, we'll re-initialize the fee estimator, as
|
||||||
|
17
config.go
17
config.go
@ -591,16 +591,10 @@ func loadConfig() (*config, error) {
|
|||||||
"litecoin.active must be set to 1 (true)", funcName)
|
"litecoin.active must be set to 1 (true)", funcName)
|
||||||
|
|
||||||
case cfg.Litecoin.Active:
|
case cfg.Litecoin.Active:
|
||||||
if cfg.Litecoin.RegTest {
|
|
||||||
str := "%s: regnet mode for litecoin not currently supported"
|
|
||||||
return nil, fmt.Errorf(str, funcName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg.Litecoin.TimeLockDelta < minTimeLockDelta {
|
if cfg.Litecoin.TimeLockDelta < minTimeLockDelta {
|
||||||
return nil, fmt.Errorf("timelockdelta must be at least %v",
|
return nil, fmt.Errorf("timelockdelta must be at least %v",
|
||||||
minTimeLockDelta)
|
minTimeLockDelta)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiple networks can't be selected simultaneously. Count
|
// Multiple networks can't be selected simultaneously. Count
|
||||||
// number of network flags passed; assign active network params
|
// number of network flags passed; assign active network params
|
||||||
// while we're at it.
|
// while we're at it.
|
||||||
@ -618,6 +612,15 @@ func loadConfig() (*config, error) {
|
|||||||
numNets++
|
numNets++
|
||||||
ltcParams = litecoinSimNetParams
|
ltcParams = litecoinSimNetParams
|
||||||
}
|
}
|
||||||
|
if cfg.Litecoin.RegTest {
|
||||||
|
numNets++
|
||||||
|
ltcParams = litecoinRegTestNetParams
|
||||||
|
}
|
||||||
|
if cfg.Litecoin.SimNet {
|
||||||
|
numNets++
|
||||||
|
ltcParams = litecoinSimNetParams
|
||||||
|
}
|
||||||
|
|
||||||
if numNets > 1 {
|
if numNets > 1 {
|
||||||
str := "%s: The mainnet, testnet, and simnet params " +
|
str := "%s: The mainnet, testnet, and simnet params " +
|
||||||
"can't be used together -- choose one of the " +
|
"can't be used together -- choose one of the " +
|
||||||
@ -700,7 +703,7 @@ func loadConfig() (*config, error) {
|
|||||||
}
|
}
|
||||||
if cfg.Bitcoin.RegTest {
|
if cfg.Bitcoin.RegTest {
|
||||||
numNets++
|
numNets++
|
||||||
activeNetParams = regTestNetParams
|
activeNetParams = bitcoinRegTestNetParams
|
||||||
}
|
}
|
||||||
if cfg.Bitcoin.SimNet {
|
if cfg.Bitcoin.SimNet {
|
||||||
numNets++
|
numNets++
|
||||||
|
2
lnd.go
2
lnd.go
@ -123,7 +123,7 @@ func Main() error {
|
|||||||
case cfg.Bitcoin.SimNet || cfg.Litecoin.SimNet:
|
case cfg.Bitcoin.SimNet || cfg.Litecoin.SimNet:
|
||||||
network = "simnet"
|
network = "simnet"
|
||||||
|
|
||||||
case cfg.Bitcoin.RegTest:
|
case cfg.Bitcoin.RegTest || cfg.Litecoin.RegTest:
|
||||||
network = "regtest"
|
network = "regtest"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user