Skip to content

Commit 0f7986c

Browse files
Darioush JalaliARR4N
authored andcommitted
add IsZero check in empty
1 parent 5c66352 commit 0f7986c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/state/state_object.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ type stateObject struct {
9393

9494
// empty returns whether the account is considered empty.
9595
func (s *stateObject) empty() bool {
96-
return s.data.Nonce == 0 && s.data.Balance.IsZero() && bytes.Equal(s.data.CodeHash, types.EmptyCodeHash.Bytes())
96+
return s.data.Nonce == 0 && s.data.Balance.IsZero() && bytes.Equal(s.data.CodeHash, types.EmptyCodeHash.Bytes()) && s.data.Extra.IsZero()
9797
}
9898

9999
// newObject creates a state object.

core/types/rlp_payload.libevm.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,7 @@ func (e *StateAccountExtra) Format(s fmt.State, verb rune) {
207207
}
208208
_, _ = s.Write([]byte(out))
209209
}
210+
211+
func (e *StateAccountExtra) IsZero() bool {
212+
return e == nil || e.t == nil || e.t.IsZero()
213+
}

0 commit comments

Comments
 (0)