diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index e1be600b0..fcb11c201 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -146,6 +146,8 @@ func initSetup() { config.Network = config.Testnet case "devnet": config.Network = config.Devnet + default: + panic(fmt.Sprintf("invalid network type: %s", *networkType)) } // Set port and ip to global config. diff --git a/common/config/global_config.go b/common/config/global_config.go index eb9dd717c..fed48ced6 100644 --- a/common/config/global_config.go +++ b/common/config/global_config.go @@ -10,5 +10,18 @@ const ( Devnet NetworkType = 2 ) +func (network NetworkType) String() string { + switch network { + case 0: + return "Mainnet" + case 1: + return "Testnet" + case 2: + return "Devnet" + default: + return "Unknown" + } +} + // Network is the type of Harmony network var Network = Testnet