diff options
author | Felix Lange <fjl@twurst.com> | 2016-10-06 04:22:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-10-06 21:32:17 +0800 |
commit | 90fce8bfa621f8c3be6663d62740783949111ff1 (patch) | |
tree | ae93f2f9f637f0530eb0cedc354871ca377717ad /core/state/statedb.go | |
parent | 1f1ea18b5414bea22332bb4fce53cc95b5c6a07d (diff) | |
download | dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.gz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.bz2 dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.lz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.xz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.zst dexon-90fce8bfa621f8c3be6663d62740783949111ff1.zip |
core/state: rename Delete/IsDeleted to Suicide/HasSuicided
The delete/remove naming has caused endless confusion in the past.
Diffstat (limited to 'core/state/statedb.go')
-rw-r--r-- | core/state/statedb.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go index 4f74302c3..ec9e9392f 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -275,10 +275,10 @@ func (self *StateDB) GetState(a common.Address, b common.Hash) common.Hash { return common.Hash{} } -func (self *StateDB) IsDeleted(addr common.Address) bool { +func (self *StateDB) HasSuicided(addr common.Address) bool { stateObject := self.GetStateObject(addr) if stateObject != nil { - return stateObject.remove + return stateObject.suicided } return false } @@ -322,22 +322,22 @@ func (self *StateDB) SetState(addr common.Address, key common.Hash, value common } } -// Delete marks the given account as suicided. +// Suicide marks the given account as suicided. // 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 Delete. -func (self *StateDB) Delete(addr common.Address) bool { +// GetStateObject will return a non-nil account after Suicide. +func (self *StateDB) Suicide(addr common.Address) bool { stateObject := self.GetStateObject(addr) if stateObject == nil { return false } - self.journal = append(self.journal, deleteAccountChange{ + self.journal = append(self.journal, suicideChange{ account: &addr, - prev: stateObject.remove, + prev: stateObject.suicided, prevbalance: new(big.Int).Set(stateObject.Balance()), }) - stateObject.markForDeletion() + stateObject.markSuicided() stateObject.data.Balance = new(big.Int) return true } @@ -516,7 +516,7 @@ func (self *StateDB) GetRefund() *big.Int { func (s *StateDB) IntermediateRoot() common.Hash { for addr, _ := range s.stateObjectsDirty { stateObject := s.stateObjects[addr] - if stateObject.remove { + if stateObject.suicided { s.deleteStateObject(stateObject) } else { stateObject.updateRoot(s.db) @@ -542,7 +542,7 @@ func (s *StateDB) DeleteSuicides() { // If the object has been removed by a suicide // flag the object as deleted. - if stateObject.remove { + if stateObject.suicided { stateObject.deleted = true } delete(s.stateObjectsDirty, addr) @@ -575,7 +575,7 @@ func (s *StateDB) commit(dbw trie.DatabaseWriter) (root common.Hash, err error) // Commit objects to the trie. for addr, stateObject := range s.stateObjects { - if stateObject.remove { + if stateObject.suicided { // If the object has been removed, don't bother syncing it // and just mark it for deletion in the trie. s.deleteStateObject(stateObject) |