aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/journal.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-11-24 23:24:04 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-11-25 05:12:54 +0800
commit12d654a6fc4580f9194a931032ebf0e1b1927279 (patch)
tree7d7654ee3c405f16a5361f52bb8bf84789989144 /core/state/journal.go
parentc04c8f10f04a41e762589358418c65fd99891bb4 (diff)
downloadgo-tangerine-12d654a6fc4580f9194a931032ebf0e1b1927279.tar.gz
go-tangerine-12d654a6fc4580f9194a931032ebf0e1b1927279.tar.zst
go-tangerine-12d654a6fc4580f9194a931032ebf0e1b1927279.zip
core, core/state: fixed consensus issue added touch revert
Implemented proper touch revert journal entries and copied a Parity consensus bug in order to remain in sync with the current longest chain.
Diffstat (limited to 'core/state/journal.go')
-rw-r--r--core/state/journal.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/state/journal.go b/core/state/journal.go
index 720c821b9..d1e73e7d0 100644
--- a/core/state/journal.go
+++ b/core/state/journal.go
@@ -67,10 +67,13 @@ type (
addLogChange struct {
txhash common.Hash
}
+ touchChange struct {
+ account *common.Address
+ prev bool
+ }
)
func (ch createObjectChange) undo(s *StateDB) {
- s.GetStateObject(*ch.account).deleted = true
delete(s.stateObjects, *ch.account)
delete(s.stateObjectsDirty, *ch.account)
}
@@ -87,6 +90,15 @@ func (ch suicideChange) undo(s *StateDB) {
}
}
+var ripemd = common.HexToAddress("0000000000000000000000000000000000000003")
+
+func (ch touchChange) undo(s *StateDB) {
+ if !ch.prev && *ch.account != ripemd {
+ delete(s.stateObjects, *ch.account)
+ delete(s.stateObjectsDirty, *ch.account)
+ }
+}
+
func (ch balanceChange) undo(s *StateDB) {
s.GetStateObject(*ch.account).setBalance(ch.prev)
}