[node] set network type for all internal configs

Signed-off-by: Leo Chen <leo@harmony.one>
pull/1730/head
Leo Chen 5 years ago
parent 2601066112
commit fb637d5057
  1. 2
      cmd/harmony/main.go
  2. 6
      internal/configs/node/config.go

@ -255,7 +255,7 @@ func createGlobalConfig() *nodeconfig.ConfigType {
netType := nodeconfig.NetworkType(*networkType) netType := nodeconfig.NetworkType(*networkType)
switch netType { switch netType {
case nodeconfig.Mainnet, nodeconfig.Testnet, nodeconfig.Pangaea, nodeconfig.Localnet, nodeconfig.Devnet: case nodeconfig.Mainnet, nodeconfig.Testnet, nodeconfig.Pangaea, nodeconfig.Localnet, nodeconfig.Devnet:
nodeConfig.SetNetworkType(netType) nodeconfig.SetNetworkType(netType)
default: default:
panic(fmt.Sprintf("invalid network type: %s", *networkType)) panic(fmt.Sprintf("invalid network type: %s", *networkType))
} }

@ -223,8 +223,10 @@ func (conf *ConfigType) Role() Role {
} }
// SetNetworkType set the networkType // SetNetworkType set the networkType
func (conf *ConfigType) SetNetworkType(networkType NetworkType) { func SetNetworkType(networkType NetworkType) {
conf.networkType = networkType for i := range shardConfigs {
shardConfigs[i].networkType = networkType
}
} }
// GetNetworkType gets the networkType // GetNetworkType gets the networkType

Loading…
Cancel
Save