|
|
@ -5,7 +5,6 @@ package nodeconfig |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"crypto/ecdsa" |
|
|
|
"crypto/ecdsa" |
|
|
|
"errors" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
|
|
|
|
|
|
|
|
@ -111,18 +110,6 @@ func GetShardConfig(shardID uint32) *ConfigType { |
|
|
|
return &shardConfigs[shardID] |
|
|
|
return &shardConfigs[shardID] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SetConfigs set ConfigType in the right index.
|
|
|
|
|
|
|
|
func SetConfigs(config ConfigType, shardID uint32) error { |
|
|
|
|
|
|
|
onceForConfigs.Do(func() { |
|
|
|
|
|
|
|
shardConfigs = make([]ConfigType, MaxShards) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if int(shardID) >= cap(shardConfigs) { |
|
|
|
|
|
|
|
return errors.New("Failed to set ConfigType") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
shardConfigs[int(shardID)] = config |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetDefaultConfig returns default config.
|
|
|
|
// GetDefaultConfig returns default config.
|
|
|
|
func GetDefaultConfig() *ConfigType { |
|
|
|
func GetDefaultConfig() *ConfigType { |
|
|
|
return &defaultConfig |
|
|
|
return &defaultConfig |
|
|
|