aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-04-12 15:54:29 +0800
committerGitHub <noreply@github.com>2018-04-12 15:54:29 +0800
commit7e911b8e476e9115d1a154aef5f6d06b954d5ab0 (patch)
treeb3f594f2ba65d26dcd4e475a69e63663ddc74a63
parent5a79aca8b918a177d192299984d8f287dd6c1eb4 (diff)
parent7205366c9f85bbfcf86ac78efcd005bb10dfc5fe (diff)
downloadgo-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar.gz
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar.bz2
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar.lz
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar.xz
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.tar.zst
go-tangerine-7e911b8e476e9115d1a154aef5f6d06b954d5ab0.zip
Merge pull request #16491 from holiman/fix_copy_again
core/state: fix ripemd-cornercase in Copy
-rw-r--r--core/state/statedb.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 97c6e4a01..3ae6843d8 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -471,8 +471,14 @@ func (self *StateDB) Copy() *StateDB {
}
// Copy the dirty states, logs, and preimages
for addr := range self.journal.dirties {
- state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state)
- state.stateObjectsDirty[addr] = struct{}{}
+ // As documented [here](https://github.com/ethereum/go-ethereum/pull/16485#issuecomment-380438527),
+ // and in the Finalise-method, there is a case where an object is in the journal but not
+ // in the stateObjects: OOG after touch on ripeMD prior to Byzantium. Thus, we need to check for
+ // nil
+ if object, exist := self.stateObjects[addr]; exist {
+ state.stateObjects[addr] = object.deepCopy(state)
+ state.stateObjectsDirty[addr] = struct{}{}
+ }
}
// Above, we don't copy the actual journal. This means that if the copy is copied, the
// loop above will be a no-op, since the copy's journal is empty.