From b89a39d341a5c1b6b6dbdb4a335ba5865327a977 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 2 May 2017 20:28:14 -0700 Subject: [PATCH] config: set chain directory _after_ the command line+config has been parsed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a bug introduced by the new multi-chain features of and which disallowed multiple nodes from beings started locally. Previously if two local nodes were set to, the _same_ chain, then they’d both share the same chain data directory which would prevent one of the nodes from being able to start up properly. --- config.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index 371d0ac1..63e49382 100644 --- a/config.go +++ b/config.go @@ -102,14 +102,12 @@ func loadConfig() (*config, error) { RPCPort: defaultRPCPort, MaxPendingChannels: defaultMaxPendingChannels, Bitcoin: &chainConfig{ - RPCHost: defaultRPCHost, - ChainDir: filepath.Join(defaultDataDir, bitcoinChain.String()), - RPCCert: defaultBtcdRPCCertFile, + RPCHost: defaultRPCHost, + RPCCert: defaultBtcdRPCCertFile, }, Litecoin: &chainConfig{ - RPCHost: defaultRPCHost, - ChainDir: filepath.Join(defaultDataDir, litecoinChain.String()), - RPCCert: defaultLtcdRPCCertFile, + RPCHost: defaultRPCHost, + RPCCert: defaultLtcdRPCCertFile, }, } @@ -190,6 +188,7 @@ func loadConfig() (*config, error) { "ltcd: %v", err) return nil, err } + cfg.Litecoin.ChainDir = filepath.Join(cfg.DataDir, litecoinChain.String()) // Finally we'll register the litecoin chain as our current // primary chain. @@ -222,6 +221,7 @@ func loadConfig() (*config, error) { "btcd: %v", err) return nil, err } + cfg.Bitcoin.ChainDir = filepath.Join(cfg.DataDir, bitcoinChain.String()) // Finally we'll register the bitcoin chain as our current // primary chain.