core: remove redundant isVerkle branch in getContractStoredBlockHash

This commit is contained in:
Forostovec 2025-09-25 16:54:58 +03:00 committed by GitHub
parent 7d8ccddaac
commit 0f022048a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,7 +247,7 @@ func TestProcessParentBlockHash(t *testing.T) {
}
// Read block hashes for block 0 .. num-1
for i := 0; i < num; i++ {
have, want := getContractStoredBlockHash(statedb, uint64(i), isVerkle), common.Hash{byte(i + 1)}
have, want := getContractStoredBlockHash(statedb, uint64(i)), common.Hash{byte(i + 1)}
if have != want {
t.Errorf("block %d, verkle=%v, have parent hash %v, want %v", i, isVerkle, have, want)
}
@ -268,13 +268,10 @@ func TestProcessParentBlockHash(t *testing.T) {
}
// getContractStoredBlockHash is a utility method which reads the stored parent blockhash for block 'number'
func getContractStoredBlockHash(statedb *state.StateDB, number uint64, isVerkle bool) common.Hash {
func getContractStoredBlockHash(statedb *state.StateDB, number uint64) common.Hash {
ringIndex := number % params.HistoryServeWindow
var key common.Hash
binary.BigEndian.PutUint64(key[24:], ringIndex)
if isVerkle {
return statedb.GetState(params.HistoryStorageAddress, key)
}
return statedb.GetState(params.HistoryStorageAddress, key)
}