Skip to content

Commit

Permalink
fix L1 miss data && data condition
Browse files Browse the repository at this point in the history
  • Loading branch information
flywukong committed Mar 25, 2022
1 parent c8425bf commit a25f788
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/state/shared_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ func NewStoragePool() *StoragePool {
// Check whether the storage exist in pool,
// new one if not exist, it will be fetched in stateObjects.GetCommittedState()
func (s *StoragePool) getStorage(address common.Address) *sync.Map {
defer s.Unlock()
s.RLock()
storageMap, ok := s.sharedMap[address]
s.RUnlock()
if !ok {
m := new(sync.Map)
s.Lock()
s.sharedMap[address] = m
s.Unlock()
return m
if _, ok := s.sharedMap[address]; !ok {
m := new(sync.Map)
s.sharedMap[address] = m
return m
}
}
return storageMap
}
1 change: 1 addition & 0 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a25f788

Please sign in to comment.