diff --git a/core/rawdb/accessors_metadata.go b/core/rawdb/accessors_metadata.go index c9ae50aeb85f..3302f0d81fae 100644 --- a/core/rawdb/accessors_metadata.go +++ b/core/rawdb/accessors_metadata.go @@ -43,7 +43,7 @@ func WriteDatabaseVersion(db ethdb.KeyValueWriter, vsn int) { // ReadChainConfig will fetch the network settings based on the given hash. func ReadChainConfig(db DatabaseReader, hash common.Hash) (*params.ChainConfig, error) { - jsonChainConfig, _ := db.Get(append(configPrefix, hash[:]...)) + jsonChainConfig, _ := db.Get(configKey(hash)) if len(jsonChainConfig) == 0 { return nil, errors.New("ChainConfig not found") // general config not found error } diff --git a/core/rawdb/schema.go b/core/rawdb/schema.go index 3fa28409bd31..2137956d1086 100644 --- a/core/rawdb/schema.go +++ b/core/rawdb/schema.go @@ -122,3 +122,8 @@ func txLookupKey(hash common.Hash) []byte { func preimageKey(hash common.Hash) []byte { return append(preimagePrefix, hash.Bytes()...) } + +// configKey = configPrefix + hash +func configKey(hash common.Hash) []byte { + return append(configPrefix, hash.Bytes()...) +}