core/state: opt stateObject.GetState (#34825)

This commit is contained in:
cui 2026-04-28 20:33:40 +08:00 committed by GitHub
parent b5d9c8d1c2
commit 0c0d299c52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -162,9 +162,12 @@ func (s *stateObject) getPrefetchedTrie() Trie {
// GetState retrieves a value associated with the given storage key. // GetState retrieves a value associated with the given storage key.
func (s *stateObject) GetState(key common.Hash) common.Hash { func (s *stateObject) GetState(key common.Hash) common.Hash {
value, _ := s.getState(key) value, dirty := s.dirtyStorage[key]
if dirty {
return value return value
} }
return s.GetCommittedState(key)
}
// getState retrieves a value associated with the given storage key, along with // getState retrieves a value associated with the given storage key, along with
// its original value. // its original value.