diff --git a/core/state/state_object.go b/core/state/state_object.go index 67e0e97466..1bf8a01f6a 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -96,7 +96,10 @@ func (s *stateObject) empty() bool { // newObject creates a state object. func newObject(db *StateDB, address common.Address, acct *types.StateAccount) *stateObject { - origin := acct + var ( + origin = acct + created = acct == nil // true if the account was not existent + ) if acct == nil { acct = types.NewEmptyStateAccount() } @@ -109,6 +112,7 @@ func newObject(db *StateDB, address common.Address, acct *types.StateAccount) *s originStorage: make(Storage), pendingStorage: make(Storage), dirtyStorage: make(Storage), + created: created, } } diff --git a/core/state/statedb.go b/core/state/statedb.go index 29f81829b2..84bb04cda8 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -691,8 +691,6 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) delete(s.storagesOrigin, prev.addrHash) } - newobj.created = true - s.setStateObject(newobj) if prev != nil && !prev.deleted { return newobj, prev