core/state: opt stateObject.GetState

This commit is contained in:
Weixie Cui 2026-04-25 18:30:59 +08:00
parent 6ece4cd143
commit c63d796fbf

View file

@ -162,9 +162,13 @@ 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
} }
origin := s.GetCommittedState(key)
return origin
}
// 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.