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

problem: concurrent rw on state db stateobjects map #614

Merged
merged 2 commits into from
Jun 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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