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 76dac12
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 @@ -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
}
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 76dac12

Please sign in to comment.