state: handle nil in journal dirties

This commit is contained in:
Martin Holst Swende 2018-04-07 19:14:20 +02:00
parent d985b9052a
commit 14c9215dd3
No known key found for this signature in database
GPG Key ID: 683B438C05A5DDF0
1 changed files with 11 additions and 1 deletions

View File

@ -517,7 +517,17 @@ func (self *StateDB) GetRefund() uint64 {
// and clears the journal as well as the refunds. // and clears the journal as well as the refunds.
func (s *StateDB) Finalise(deleteEmptyObjects bool) { func (s *StateDB) Finalise(deleteEmptyObjects bool) {
for addr := range s.journal.dirties { 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()) { if stateObject.suicided || (deleteEmptyObjects && stateObject.empty()) {
s.deleteStateObject(stateObject) s.deleteStateObject(stateObject)
} else { } else {