From 352461d55141d50fb1b6f6cec221e8dbb839b7aa Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 12 Jul 2017 01:54:43 +0200 Subject: [PATCH] config: add regtest support to lnd Support for regtest allows us to create integration tests to verify interoperability with other implementations. This seems to work, and allows to connect to `btcd` and indirectly to `bitcoind` so we can run lnd on the same network as eclair and c-lightning. For details about my integration framework check this repo: cdecker/lightning-integration --- config.go | 5 +++++ params.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/config.go b/config.go index b3930b01..f9ebf088 100644 --- a/config.go +++ b/config.go @@ -57,6 +57,7 @@ type chainConfig struct { TestNet3 bool `long:"testnet" description:"Use the test network"` SimNet bool `long:"simnet" description:"Use the simulation test network"` + RegTest bool `long:"regtest" description:"Use the regression test network"` } type neutrinoConfig struct { @@ -231,6 +232,10 @@ func loadConfig() (*config, error) { numNets++ activeNetParams = bitcoinTestNetParams } + if cfg.Bitcoin.RegTest { + numNets++ + activeNetParams = regTestNetParams + } if cfg.Bitcoin.SimNet { activeNetParams = bitcoinSimNetParams } diff --git a/params.go b/params.go index 9eda0038..828eb819 100644 --- a/params.go +++ b/params.go @@ -45,6 +45,12 @@ var liteTestNetParams = litecoinNetParams{ rpcPort: "19334", } +// regTestNetParams contains parameters specific to a local regtest network. +var regTestNetParams = bitcoinNetParams{ + Params: &bitcoinCfg.RegressionNetParams, + rpcPort: "18334", +} + // 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