aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-04-08 01:14:20 +0800
committerMartin Holst Swende <martin@swende.se>2018-04-10 17:20:02 +0800
commit14c9215dd3afa7613c768a71baf40224df5e6aca (patch)
treec104b86ae5d443c834a81d9b70f7fa96d4ec3562 /core
parentd985b9052ae08f2538e6caa7e6b5ef351a00bc3e (diff)
downloadgo-tangerine-14c9215dd3afa7613c768a71baf40224df5e6aca.tar.gz
go-tangerine-14c9215dd3afa7613c768a71baf40224df5e6aca.tar.zst
go-tangerine-14c9215dd3afa7613c768a71baf40224df5e6aca.zip
state: handle nil in journal dirties
Diffstat (limited to 'core')
-rw-r--r--core/state/statedb.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go
index c7ef49f64..08f18c2d2 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -517,7 +517,17 @@ func (self *StateDB) GetRefund() uint64 {
// and clears the journal as well as the refunds.
func (s *StateDB) Finalise(deleteEmptyObjects bool) {
for addr := range s.journal.dirties {
- stateObject := s.stateObjects[addr]
+ stateObject, exist := s.stateObjects[addr]
+ if !exist {
+ // ripeMD is 'touched' at block 1714175, in tx 0x1237f737031e40bcde4a8b7e717b2d15e3ecadfe49bb1bbc71ee9deb09c6fcf2
+ // That tx goes out of gas, and although the notion of 'touched' does not exist there, the
+ // touch-event will still be recorded in the journal. Since ripeMD is a special snowflake,
+ // it will persist in the journal even though the journal is reverted. In this special circumstance,
+ // it may exist in `s.journal.dirties` but not in `s.stateObjects`.
+ // Thus, we can safely ignore it here
+ continue
+ }
+
if stateObject.suicided || (deleteEmptyObjects && stateObject.empty()) {
s.deleteStateObject(stateObject)
} else {