mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
Update config.go
This commit is contained in:
parent
090cf7ccec
commit
1ff3345d13
1 changed files with 12 additions and 4 deletions
|
|
@ -108,18 +108,26 @@ func (c *ChainConfig) LoadForks(path string) error {
|
||||||
for key, value := range config {
|
for key, value := range config {
|
||||||
if strings.HasSuffix(key, "_FORK_VERSION") {
|
if strings.HasSuffix(key, "_FORK_VERSION") {
|
||||||
name := key[:len(key)-len("_FORK_VERSION")]
|
name := key[:len(key)-len("_FORK_VERSION")]
|
||||||
if v, err := hexutil.Decode(fmt.Sprintf("0x%x", value)); err == nil {
|
version, ok := value.(string)
|
||||||
|
if !ok {
|
||||||
|
version = fmt.Sprintf("0x%x", value)
|
||||||
|
}
|
||||||
|
if v, err := hexutil.Decode(version); err == nil {
|
||||||
versions[name] = v
|
versions[name] = v
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("failed to decode hex fork id %v in beacon chain config file: %v", value, err)
|
return fmt.Errorf("failed to decode hex fork id %q in beacon chain config file: %v", version, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(key, "_FORK_EPOCH") {
|
if strings.HasSuffix(key, "_FORK_EPOCH") {
|
||||||
name := key[:len(key)-len("_FORK_EPOCH")]
|
name := key[:len(key)-len("_FORK_EPOCH")]
|
||||||
if v, err := hexutil.DecodeUint64(fmt.Sprintf("0x%x", value)); err == nil {
|
version, ok := value.(string)
|
||||||
|
if !ok {
|
||||||
|
version = fmt.Sprintf("0x%x", value)
|
||||||
|
}
|
||||||
|
if v, err := hexutil.DecodeUint64(version); err == nil {
|
||||||
epochs[name] = v
|
epochs[name] = v
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("failed to parse epoch number %v in beacon chain config file: %v", value, err)
|
return fmt.Errorf("failed to parse epoch number %q in beacon chain config file: %v", version, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue