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
This commit is contained in:
Christian Decker 2017-07-12 01:54:43 +02:00 committed by Olaoluwa Osuntokun
parent cc8008d5e1
commit 352461d551
2 changed files with 11 additions and 0 deletions

@ -57,6 +57,7 @@ type chainConfig struct {
TestNet3 bool `long:"testnet" description:"Use the test network"` TestNet3 bool `long:"testnet" description:"Use the test network"`
SimNet bool `long:"simnet" description:"Use the simulation 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 { type neutrinoConfig struct {
@ -231,6 +232,10 @@ func loadConfig() (*config, error) {
numNets++ numNets++
activeNetParams = bitcoinTestNetParams activeNetParams = bitcoinTestNetParams
} }
if cfg.Bitcoin.RegTest {
numNets++
activeNetParams = regTestNetParams
}
if cfg.Bitcoin.SimNet { if cfg.Bitcoin.SimNet {
activeNetParams = bitcoinSimNetParams activeNetParams = bitcoinSimNetParams
} }

@ -45,6 +45,12 @@ var liteTestNetParams = litecoinNetParams{
rpcPort: "19334", 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 // applyLitecoinParams applies the relevant chain configuration parameters that
// differ for litecoin to the chain parameters typed for btcsuite derivation. // differ for litecoin to the chain parameters typed for btcsuite derivation.
// This function is used in place of using something like interface{} to // This function is used in place of using something like interface{} to