Skip to content

Commit

Permalink
core/state: make stateobject.create selfcontain (#28459)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored Nov 29, 2023
1 parent 28e7371 commit ab0eb46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,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()
}
Expand All @@ -111,6 +114,7 @@ func newObject(db *StateDB, address common.Address, acct *types.StateAccount) *s
originStorage: make(Storage),
pendingStorage: make(Storage),
dirtyStorage: make(Storage),
created: created,
}
}

Expand Down
3 changes: 0 additions & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
delete(s.accountsOrigin, prev.address)
delete(s.storagesOrigin, prev.address)
}

newobj.created = true

s.setStateObject(newobj)
if prev != nil && !prev.deleted {
return newobj, prev
Expand Down

0 comments on commit ab0eb46

Please sign in to comment.