Panic for invalid network type

pull/1121/head
Rongjian Lan 6 years ago
parent f04bbab3e8
commit 2c83876f2f
  1. 2
      cmd/harmony/main.go
  2. 13
      common/config/global_config.go

@ -146,6 +146,8 @@ func initSetup() {
config.Network = config.Testnet config.Network = config.Testnet
case "devnet": case "devnet":
config.Network = config.Devnet config.Network = config.Devnet
default:
panic(fmt.Sprintf("invalid network type: %s", *networkType))
} }
// Set port and ip to global config. // Set port and ip to global config.

@ -10,5 +10,18 @@ const (
Devnet NetworkType = 2 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 // Network is the type of Harmony network
var Network = Testnet var Network = Testnet

Loading…
Cancel
Save