Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #614 from ethereumproject/fix-statedb-stateobject-…
Browse files Browse the repository at this point in the history
…concurrent-rw-panic

problem: concurrent rw on state db stateobjects map
  • Loading branch information
whilei authored Jun 4, 2018
2 parents a9c8b13 + 476a39f commit a3d20f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ func (self *StateDB) deleteStateObject(stateObject *StateObject) {
// Retrieve a state object given my the address. Returns nil if not found.
func (self *StateDB) getStateObject(addr common.Address) (stateObject *StateObject) {
// Prefer 'live' objects.
if obj := self.stateObjects[addr]; obj != nil {
self.lock.Lock()
obj := self.stateObjects[addr]
self.lock.Unlock()
if obj != nil {
if obj.deleted {
return nil
}
Expand All @@ -368,7 +371,7 @@ func (self *StateDB) getStateObject(addr common.Address) (stateObject *StateObje
return nil
}
// Insert into the live set.
obj := newObject(self, addr, data, self.MarkStateObjectDirty)
obj = newObject(self, addr, data, self.MarkStateObjectDirty)
self.setStateObject(obj)
return obj
}
Expand Down

0 comments on commit a3d20f6

Please sign in to comment.