diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index 70ebaae90..411829c32 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -139,12 +139,6 @@ var ( "Do not propose view change (testing only)") ) -const ( - MainNet = "mainnet" - TestNet = "testnet" - DevNet = "devnet" -) - func initSetup() { // Set port and ip to global config. nodeconfig.GetDefaultConfig().Port = *port @@ -260,11 +254,11 @@ func createGlobalConfig() *nodeconfig.ConfigType { // Set network type switch *networkType { - case MainNet: + case nodeconfig.Mainnet: nodeConfig.SetNetworkType(nodeconfig.Mainnet) - case TestNet: + case nodeconfig.Testnet: nodeConfig.SetNetworkType(nodeconfig.Testnet) - case DevNet: + case nodeconfig.Devnet: nodeConfig.SetNetworkType(nodeconfig.Devnet) default: panic(fmt.Sprintf("invalid network type: %s", *networkType)) @@ -495,7 +489,7 @@ func main() { currentNode.ServiceManagerSetup() // RPC for SDK not supported for mainnet. - if *networkType != MainNet { + if *networkType != nodeconfig.Mainnet { if err := currentNode.StartRPC(*port); err != nil { ctxerror.Warn(utils.GetLogger(), err, "StartRPC failed") } diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index 5b77598de..7ad2b340b 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -56,27 +56,15 @@ func (role Role) String() string { } // NetworkType describes the type of Harmony network -type NetworkType int +type NetworkType string // Constants for NetworkType const ( - Mainnet NetworkType = iota - Testnet - Devnet + Mainnet = "mainnet" + Testnet = "testnet" + Devnet = "devnet" ) -func (network NetworkType) String() string { - switch network { - case Mainnet: - return "Mainnet" - case Testnet: - return "Testnet" - case Devnet: - return "Devnet" - } - return "Unknown" -} - // Network is the type of Harmony network var Network = Testnet