|
|
|
@ -271,7 +271,7 @@ func (s *StateDB) SubRefund(gas uint64) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Exist reports whether the given account address exists in the state.
|
|
|
|
|
// Notably this also returns true for suicided accounts.
|
|
|
|
|
// Notably this also returns true for self-destructed accounts.
|
|
|
|
|
func (s *StateDB) Exist(addr common.Address) bool { |
|
|
|
|
return s.getStateObject(addr) != nil |
|
|
|
|
} |
|
|
|
@ -397,10 +397,10 @@ func (s *StateDB) StorageTrie(addr common.Address) (Trie, error) { |
|
|
|
|
return cpy.getTrie(s.db) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *StateDB) HasSuicided(addr common.Address) bool { |
|
|
|
|
func (s *StateDB) HasSelfDestructed(addr common.Address) bool { |
|
|
|
|
stateObject := s.getStateObject(addr) |
|
|
|
|
if stateObject != nil { |
|
|
|
|
return stateObject.suicided |
|
|
|
|
return stateObject.selfDestructed |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
@ -474,24 +474,23 @@ func (s *StateDB) SetStorage(addr common.Address, storage map[common.Hash]common |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Suicide marks the given account as suicided.
|
|
|
|
|
// SelfDestruct marks the given account as selfdestructed.
|
|
|
|
|
// This clears the account balance.
|
|
|
|
|
//
|
|
|
|
|
// The account's state object is still available until the state is committed,
|
|
|
|
|
// getStateObject will return a non-nil account after Suicide.
|
|
|
|
|
func (s *StateDB) Suicide(addr common.Address) bool { |
|
|
|
|
// getStateObject will return a non-nil account after SelfDestruct.
|
|
|
|
|
func (s *StateDB) SelfDestruct(addr common.Address) { |
|
|
|
|
stateObject := s.getStateObject(addr) |
|
|
|
|
if stateObject == nil { |
|
|
|
|
return false |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
s.journal.append(suicideChange{ |
|
|
|
|
s.journal.append(selfDestructChange{ |
|
|
|
|
account: &addr, |
|
|
|
|
prev: stateObject.suicided, |
|
|
|
|
prev: stateObject.selfDestructed, |
|
|
|
|
prevbalance: new(big.Int).Set(stateObject.Balance()), |
|
|
|
|
}) |
|
|
|
|
stateObject.markSuicided() |
|
|
|
|
stateObject.markSelfdestructed() |
|
|
|
|
stateObject.data.Balance = new(big.Int) |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SetTransientState sets transient storage for a given account. It
|
|
|
|
@ -892,7 +891,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) { |
|
|
|
|
// Thus, we can safely ignore it here
|
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
if obj.suicided || (deleteEmptyObjects && obj.empty()) { |
|
|
|
|
if obj.selfDestructed || (deleteEmptyObjects && obj.empty()) { |
|
|
|
|
obj.deleted = true |
|
|
|
|
|
|
|
|
|
// We need to maintain account deletions explicitly (will remain
|
|
|
|
|