aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/journal.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2017-05-13 03:47:09 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-05-18 15:05:58 +0800
commite7119ce12d86634dd487ab3c55bf9b98f327236c (patch)
tree8cbcab0d486999e4882f6d7a340e3b2dae562376 /core/state/journal.go
parenta5f6a1cb7c5e5dde130391e9bed7625ef9ff36b5 (diff)
downloaddexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar.gz
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar.bz2
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar.lz
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar.xz
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.tar.zst
dexon-e7119ce12d86634dd487ab3c55bf9b98f327236c.zip
core/state: fixed (self)destructed objects
Add the object to the list of destructed objects during a selfdestruct / suicide operation and also remove it from the list once the journal reverts.
Diffstat (limited to 'core/state/journal.go')
-rw-r--r--core/state/journal.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/state/journal.go b/core/state/journal.go
index 73218dd28..b5c8ca9a2 100644
--- a/core/state/journal.go
+++ b/core/state/journal.go
@@ -71,8 +71,8 @@ type (
hash common.Hash
}
touchChange struct {
- account *common.Address
- prev bool
+ account *common.Address
+ prev bool
prevDirty bool
}
)
@@ -91,6 +91,11 @@ func (ch suicideChange) undo(s *StateDB) {
if obj != nil {
obj.suicided = ch.prev
obj.setBalance(ch.prevbalance)
+ // if the object wasn't suicided before, remove
+ // it from the list of destructed objects as well.
+ if !obj.suicided {
+ delete(s.stateObjectsDestructed, *ch.account)
+ }
}
}