From fb637d50578babd35acec90aa15f3a0b78281a9d Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 15 Oct 2019 07:21:09 +0000 Subject: [PATCH] [node] set network type for all internal configs Signed-off-by: Leo Chen --- cmd/harmony/main.go | 2 +- internal/configs/node/config.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index 32d924837..91129e05b 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -255,7 +255,7 @@ func createGlobalConfig() *nodeconfig.ConfigType { netType := nodeconfig.NetworkType(*networkType) switch netType { case nodeconfig.Mainnet, nodeconfig.Testnet, nodeconfig.Pangaea, nodeconfig.Localnet, nodeconfig.Devnet: - nodeConfig.SetNetworkType(netType) + nodeconfig.SetNetworkType(netType) default: panic(fmt.Sprintf("invalid network type: %s", *networkType)) } diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index 21f1ab3c1..28aa01b90 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -223,8 +223,10 @@ func (conf *ConfigType) Role() Role { } // SetNetworkType set the networkType -func (conf *ConfigType) SetNetworkType(networkType NetworkType) { - conf.networkType = networkType +func SetNetworkType(networkType NetworkType) { + for i := range shardConfigs { + shardConfigs[i].networkType = networkType + } } // GetNetworkType gets the networkType