mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
Merge pull request #2189 from sparkswap/sparkswap/litecoin-regtest
add litecoin regtest to lnd
This commit is contained in:
commit
517cdd66bf
@ -78,8 +78,17 @@ var litecoinMainNetParams = litecoinNetParams{
|
||||
CoinType: keychain.CoinTypeLitecoin,
|
||||
}
|
||||
|
||||
// regTestNetParams contains parameters specific to a local regtest network.
|
||||
var regTestNetParams = bitcoinNetParams{
|
||||
// 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{
|
||||
Params: &bitcoinCfg.RegressionNetParams,
|
||||
rpcPort: "18334",
|
||||
CoinType: keychain.CoinTypeTestnet,
|
||||
|
@ -256,10 +256,15 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
||||
rpcPort -= 2
|
||||
bitcoindHost = fmt.Sprintf("%v:%d",
|
||||
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)
|
||||
if err != nil || conn == nil {
|
||||
rpcPort = 18443
|
||||
if cfg.Bitcoin.Active && cfg.Bitcoin.RegTest {
|
||||
rpcPort = 18443
|
||||
} else if cfg.Litecoin.Active && cfg.Litecoin.RegTest {
|
||||
rpcPort = 19443
|
||||
}
|
||||
bitcoindHost = fmt.Sprintf("%v:%d",
|
||||
bitcoindMode.RPCHost,
|
||||
rpcPort)
|
||||
@ -320,7 +325,7 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
||||
if err := cc.feeEstimator.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if cfg.Litecoin.Active {
|
||||
} else if cfg.Litecoin.Active && !cfg.Litecoin.RegTest {
|
||||
ltndLog.Infof("Initializing litecoind backed fee estimator")
|
||||
|
||||
// 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)
|
||||
|
||||
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 {
|
||||
return nil, fmt.Errorf("timelockdelta must be at least %v",
|
||||
minTimeLockDelta)
|
||||
}
|
||||
|
||||
// Multiple networks can't be selected simultaneously. Count
|
||||
// number of network flags passed; assign active network params
|
||||
// while we're at it.
|
||||
@ -618,6 +612,15 @@ func loadConfig() (*config, error) {
|
||||
numNets++
|
||||
ltcParams = litecoinSimNetParams
|
||||
}
|
||||
if cfg.Litecoin.RegTest {
|
||||
numNets++
|
||||
ltcParams = litecoinRegTestNetParams
|
||||
}
|
||||
if cfg.Litecoin.SimNet {
|
||||
numNets++
|
||||
ltcParams = litecoinSimNetParams
|
||||
}
|
||||
|
||||
if numNets > 1 {
|
||||
str := "%s: The mainnet, testnet, and simnet params " +
|
||||
"can't be used together -- choose one of the " +
|
||||
@ -700,7 +703,7 @@ func loadConfig() (*config, error) {
|
||||
}
|
||||
if cfg.Bitcoin.RegTest {
|
||||
numNets++
|
||||
activeNetParams = regTestNetParams
|
||||
activeNetParams = bitcoinRegTestNetParams
|
||||
}
|
||||
if cfg.Bitcoin.SimNet {
|
||||
numNets++
|
||||
|
Loading…
Reference in New Issue
Block a user