Patch for concurrent iterator & others (onto v1.11.6) #386

Closed
roysc wants to merge 1565 commits from v1.11.6-statediff-v5 into master
Showing only changes of commit 0e35192797 - Show all commits

View File

@ -41,16 +41,14 @@ func WritePreimages(db ethdb.KeyValueWriter, preimages map[common.Hash][]byte) {
// ReadCode retrieves the contract code of the provided code hash. // ReadCode retrieves the contract code of the provided code hash.
func ReadCode(db ethdb.KeyValueReader, hash common.Hash) []byte { func ReadCode(db ethdb.KeyValueReader, hash common.Hash) []byte {
// Try with the legacy code scheme first, if not then try with current // Try with the prefixed code scheme first, if not then try with legacy
// scheme. Since most of the code will be found with legacy scheme. // scheme.
// data := ReadCodeWithPrefix(db, hash)
// todo(rjl493456442) change the order when we forcibly upgrade the code
// scheme with snapshot.
data, _ := db.Get(hash[:])
if len(data) != 0 { if len(data) != 0 {
return data return data
} }
return ReadCodeWithPrefix(db, hash) data, _ := db.Get(hash[:])
return data
} }
// ReadCodeWithPrefix retrieves the contract code of the provided code hash. // ReadCodeWithPrefix retrieves the contract code of the provided code hash.