mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
core/state: track slot reads for empty storage
This commit is contained in:
parent
a5e6a157e5
commit
3c5440b87a
1 changed files with 13 additions and 0 deletions
|
|
@ -188,6 +188,19 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash {
|
|||
// have been handles via pendingStorage above.
|
||||
// 2) we don't have new values, and can deliver empty response back
|
||||
if _, destructed := s.db.stateObjectsDestruct[s.address]; destructed {
|
||||
// Invoke the reader regardless and discard the returned value.
|
||||
// The returned value may not be empty, as it could belong to a
|
||||
// self-destructed contract.
|
||||
//
|
||||
// The read operation is still essential for correctly building
|
||||
// the block-level access list.
|
||||
//
|
||||
// TODO(rjl493456442) the reader interface can be extended with
|
||||
// Touch, recording the read access without the actual disk load.
|
||||
_, err := s.db.reader.Storage(s.address, key)
|
||||
if err != nil {
|
||||
s.db.setError(err)
|
||||
}
|
||||
s.originStorage[key] = common.Hash{} // track the empty slot as origin value
|
||||
return common.Hash{}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue