Skip to content

Commit

Permalink
fix cache key do not have hash func (#455)
Browse files Browse the repository at this point in the history
Signed-off-by: kyrie-yl <yl.on.the.way@gmail.com>
  • Loading branch information
kyrie-yl authored Oct 15, 2021
1 parent 8f605f5 commit aecb612
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,15 @@ func (db *cachingDB) ContractCode(addrHash, codeHash common.Hash) ([]byte, error
// code can't be found in the cache, then check the existence with **new**
// db scheme.
func (db *cachingDB) ContractCodeWithPrefix(addrHash, codeHash common.Hash) ([]byte, error) {
if cached, ok := db.codeCache.Get(codeHash.Bytes()); ok {
if cached, ok := db.codeCache.Get(codeHash); ok {
code := cached.([]byte)
if len(code) > 0 {
return code, nil
}
}
code := rawdb.ReadCodeWithPrefix(db.db.DiskDB(), codeHash)
if len(code) > 0 {
db.codeCache.Add(codeHash.Bytes(), code)
db.codeCache.Add(codeHash, code)
db.codeSizeCache.Add(codeHash, len(code))
return code, nil
}
Expand Down

0 comments on commit aecb612

Please sign in to comment.