File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -201,14 +201,19 @@ func (self *StateObject) Copy() *StateObject {
201
201
// Attribute accessors
202
202
//
203
203
204
+ // empty returns whether the account is considered empty.
205
+ func (self * StateObject ) empty () bool {
206
+ return self .nonce == 0 && self .balance .BitLen () == 0 && bytes .Equal (self .codeHash , emptyCodeHash )
207
+ }
208
+
204
209
// Balance returns the account balance
205
210
func (self * StateObject ) Balance () * big.Int {
206
211
return self .balance
207
212
}
208
213
209
214
// Address returns the address of the contract/account
210
- func (c * StateObject ) Address () common.Address {
211
- return c .address
215
+ func (self * StateObject ) Address () common.Address {
216
+ return self .address
212
217
}
213
218
214
219
// Code returns the contract code
Original file line number Diff line number Diff line change @@ -263,6 +263,13 @@ func (s *VMState) Exist(addr common.Address) bool {
263
263
return res
264
264
}
265
265
266
+ // Empty returns true if the account at the given address is considered empty
267
+ func (s * VMState ) Empty (addr common.Address ) bool {
268
+ so , err := s .state .GetStateObject (s .ctx , addr )
269
+ s .errHandler (err )
270
+ return so == nil || so .empty ()
271
+ }
272
+
266
273
// HasSuicided returns true if the given account has been marked for deletion
267
274
// or false if the account does not exist
268
275
func (s * VMState ) HasSuicided (addr common.Address ) bool {
You can’t perform that action at this time.
0 commit comments