Skip to content

Commit

Permalink
fix ReadChainConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Jan 17, 2025
1 parent a29ee8b commit cb24ac0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/rawdb/accessors_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions core/rawdb/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()...)
}

0 comments on commit cb24ac0

Please sign in to comment.