From 476a39f26ca7b0960f47abb623b92ca19d467664 Mon Sep 17 00:00:00 2001 From: ia Date: Mon, 4 Jun 2018 17:51:27 +0200 Subject: [PATCH] problem: bad fit for scoped conditional value --- core/state/statedb.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 6226975a4..01887a9b7 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -350,14 +350,14 @@ func (self *StateDB) deleteStateObject(stateObject *StateObject) { func (self *StateDB) getStateObject(addr common.Address) (stateObject *StateObject) { // Prefer 'live' objects. self.lock.Lock() - if obj := self.stateObjects[addr]; obj != nil { - self.lock.Unlock() + obj := self.stateObjects[addr] + self.lock.Unlock() + if obj != nil { if obj.deleted { return nil } return obj } - self.lock.Unlock() // Load the object from the database. enc, err := self.trie.TryGet(addr[:]) @@ -371,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 }