lnd: properly switch RPC port with target net change
With this commit, support for changing the target network (testnet, simnet, etc) has been finalized. Previously a command line option was present to swap networks, but the RPC port wouldn’t automatically be updated to reflect the network.
This commit is contained in:
5 files changed
+44
-19
No files matched your search
@@ -9,7 +9,6 @@ import (
|
||||
"strings"
|
||||
|
||||
flags "github.com/btcsuite/go-flags"
|
||||
"github.com/roasbeef/btcd/chaincfg"
|
||||
"github.com/roasbeef/btcutil"
|
||||
)
|
||||
|
||||
@@ -34,10 +33,6 @@ var (
|
||||
defaultDataDir = filepath.Join(lndHomeDir, defaultDataDirname)
|
||||
defaultLogDir = filepath.Join(lndHomeDir, defaultLogDirname)
|
||||
|
||||
// activeNetParams is a pointer to the parameters specific to the
|
||||
// currently active bitcoin network.
|
||||
activeNetParams = &chaincfg.SegNet4Params
|
||||
|
||||
btcdHomeDir = btcutil.AppDataDir("btcd", false)
|
||||
defaultRPCKeyFile = filepath.Join(btcdHomeDir, "rpc.key")
|
||||
defaultRPCCertFile = filepath.Join(btcdHomeDir, "rpc.cert")
|
||||
@@ -154,15 +149,11 @@ func loadConfig() (*config, error) {
|
||||
numNets := 0
|
||||
if cfg.TestNet3 {
|
||||
numNets++
|
||||
activeNetParams = &chaincfg.TestNet3Params
|
||||
}
|
||||
if cfg.SegNet {
|
||||
numNets++
|
||||
activeNetParams = &chaincfg.SegNet4Params
|
||||
activeNetParams = testNetParams
|
||||
}
|
||||
if cfg.SimNet {
|
||||
numNets++
|
||||
activeNetParams = &chaincfg.SimNetParams
|
||||
activeNetParams = simNetParams
|
||||
}
|
||||
if numNets > 1 {
|
||||
str := "%s: The testnet, segnet, and simnet params can't be " +
|
||||
|
||||
Reference in new issue
Block a user