diff --git a/core/state/shared_pool.go b/core/state/shared_pool.go index 8e5994a6b1..ead71896cc 100644 --- a/core/state/shared_pool.go +++ b/core/state/shared_pool.go @@ -27,11 +27,13 @@ func (s *StoragePool) getStorage(address common.Address) *sync.Map { storageMap, ok := s.sharedMap[address] s.RUnlock() if !ok { - m := new(sync.Map) s.Lock() - s.sharedMap[address] = m - s.Unlock() - return m + defer s.Unlock() + if storageMap, ok = s.sharedMap[address]; !ok { + m := new(sync.Map) + s.sharedMap[address] = m + return m + } } return storageMap } diff --git a/core/state/state_object.go b/core/state/state_object.go index d50b8601de..c5212e91cc 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -214,6 +214,7 @@ func (s *StateObject) getOriginStorage(key common.Hash) (common.Hash, bool) { if !ok { return common.Hash{}, false } + s.originStorage[key] = val.(common.Hash) return val.(common.Hash), true } return common.Hash{}, false