From 28213b784f6a83271e79dddbb27e232558cc47ee Mon Sep 17 00:00:00 2001 From: Offer Markovich Date: Fri, 14 Sep 2018 09:03:09 +0300 Subject: [PATCH] config: Experimental support for Litecoin/simnet This PR adds the configuration needed to run LND with Litecoin on simnet. The change is minimal and has no impact for users that don't enable this mode. When using this configuration, the user is being warned that this mode is not officially supported. --- chainparams.go | 8 ++++++++ config.go | 8 ++++---- lnd.go | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/chainparams.go b/chainparams.go index 812bb6f3..2d65d68a 100644 --- a/chainparams.go +++ b/chainparams.go @@ -54,6 +54,14 @@ var bitcoinSimNetParams = bitcoinNetParams{ CoinType: keychain.CoinTypeTestnet, } +// litecoinSimNetParams contains parameters specific to the simulation test +// network. +var litecoinSimNetParams = litecoinNetParams{ + Params: &litecoinCfg.SimNetParams, + rpcPort: "18556", + CoinType: keychain.CoinTypeTestnet, +} + // litecoinTestNetParams contains parameters specific to the 4th version of the // test network. var litecoinTestNetParams = litecoinNetParams{ diff --git a/config.go b/config.go index f39099e1..bdb73346 100644 --- a/config.go +++ b/config.go @@ -541,10 +541,6 @@ func loadConfig() (*config, error) { "litecoin.active must be set to 1 (true)", funcName) case cfg.Litecoin.Active: - if cfg.Litecoin.SimNet { - str := "%s: simnet mode for litecoin not currently supported" - return nil, fmt.Errorf(str, funcName) - } if cfg.Litecoin.RegTest { str := "%s: regnet mode for litecoin not currently supported" return nil, fmt.Errorf(str, funcName) @@ -568,6 +564,10 @@ func loadConfig() (*config, error) { numNets++ ltcParams = litecoinTestNetParams } + 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 " + diff --git a/lnd.go b/lnd.go index e323e95d..6f15269a 100644 --- a/lnd.go +++ b/lnd.go @@ -123,7 +123,7 @@ func lndMain() error { case cfg.Bitcoin.MainNet || cfg.Litecoin.MainNet: network = "mainnet" - case cfg.Bitcoin.SimNet: + case cfg.Bitcoin.SimNet || cfg.Litecoin.SimNet: network = "simnet" case cfg.Bitcoin.RegTest: