[stream] updated mainnet default config, default sync values and versions

pull/3588/head
Jacky Wang 4 years ago
parent 79f9e12168
commit bbe14e7500
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 24
      cmd/harmony/config_test.go
  2. 16
      cmd/harmony/default.go

@ -30,7 +30,7 @@ func init() {
}
func TestV1_0_0Config(t *testing.T) {
testConfig := `Version = "1.0.3"
testConfig := `Version = "1.0.4"
[BLSKeys]
KMSConfigFile = ""
@ -80,6 +80,17 @@ func TestV1_0_0Config(t *testing.T) {
[TxPool]
BlacklistFile = "./.hmy/blacklist.txt"
[Sync]
Concurrency = 6
DiscBatch = 8
DiscHardLowCap = 6
DiscHighCap = 128
DiscSoftLowCap = 8
InitStreams = 8
LegacyClient = false
LegacyServer = true
MinPeers = 6
[WS]
Enabled = true
IP = "127.0.0.1"
@ -96,20 +107,21 @@ func TestV1_0_0Config(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defConf := getDefaultHmyConfigCopy(nodeconfig.Mainnet)
if config.HTTP.RosettaEnabled {
t.Errorf("Expected rosetta http server to be disabled when loading old config")
}
if config.General.IsOffline {
t.Errorf("Expect node to de online when loading old config")
}
if config.P2P.IP != defaultConfig.P2P.IP {
if config.P2P.IP != defConf.P2P.IP {
t.Errorf("Expect default p2p IP if old config is provided")
}
if config.Version != "1.0.3" {
t.Errorf("Expected config version: 1.0.3, not %v", config.Version)
if config.Version != "1.0.4" {
t.Errorf("Expected config version: 1.0.4, not %v", config.Version)
}
config.Version = defaultConfig.Version // Shortcut for testing, value checked above
if !reflect.DeepEqual(config, defaultConfig) {
config.Version = defConf.Version // Shortcut for testing, value checked above
if !reflect.DeepEqual(config, defConf) {
t.Errorf("Unexpected config \n\t%+v \n\t%+v", config, defaultConfig)
}
}

@ -2,7 +2,7 @@ package main
import nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
const tomlConfigVersion = "1.0.3"
const tomlConfigVersion = "1.0.4"
const (
defNetworkType = nodeconfig.Mainnet
@ -106,13 +106,13 @@ var (
defaultMainnetSyncConfig = syncConfig{
LegacyServer: true,
LegacyClient: false,
Concurrency: 16,
MinPeers: 16,
InitStreams: 32,
DiscSoftLowCap: 16,
DiscHardLowCap: 32,
Concurrency: 6,
MinPeers: 6,
InitStreams: 8,
DiscSoftLowCap: 8,
DiscHardLowCap: 6,
DiscHighCap: 128,
DiscBatch: 16,
DiscBatch: 8,
}
defaultTestNetSyncConfig = syncConfig{
@ -152,6 +152,8 @@ func getDefaultHmyConfigCopy(nt nodeconfig.NetworkType) harmonyConfig {
devnet := getDefaultDevnetConfigCopy()
config.Devnet = &devnet
}
config.Sync = getDefaultSyncConfig(nt)
return config
}

Loading…
Cancel
Save