|
@@ -287,7 +287,7 @@ func (db *cachingDB) ContractCode(addrHash, codeHash common.Hash) ([]byte, error
|
|
|
// code can't be found in the cache, then check the existence with **new**
|
|
// code can't be found in the cache, then check the existence with **new**
|
|
|
// db scheme.
|
|
// db scheme.
|
|
|
func (db *cachingDB) ContractCodeWithPrefix(addrHash, codeHash common.Hash) ([]byte, error) {
|
|
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)
|
|
code := cached.([]byte)
|
|
|
if len(code) > 0 {
|
|
if len(code) > 0 {
|
|
|
return code, nil
|
|
return code, nil
|
|
@@ -295,7 +295,7 @@ func (db *cachingDB) ContractCodeWithPrefix(addrHash, codeHash common.Hash) ([]b
|
|
|
}
|
|
}
|
|
|
code := rawdb.ReadCodeWithPrefix(db.db.DiskDB(), codeHash)
|
|
code := rawdb.ReadCodeWithPrefix(db.db.DiskDB(), codeHash)
|
|
|
if len(code) > 0 {
|
|
if len(code) > 0 {
|
|
|
- db.codeCache.Add(codeHash.Bytes(), code)
|
|
|
|
|
|
|
+ db.codeCache.Add(codeHash, code)
|
|
|
db.codeSizeCache.Add(codeHash, len(code))
|
|
db.codeSizeCache.Add(codeHash, len(code))
|
|
|
return code, nil
|
|
return code, nil
|
|
|
}
|
|
}
|