fix csdb.Copy (#488)

This commit is contained in:
noot 2020-08-31 08:59:47 -06:00 committed by GitHub
parent 8a3692e174
commit a6e152bbb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -695,14 +695,14 @@ func (csdb *CommitStateDB) Copy() *CommitStateDB {
}
// copy the dirty states, logs, and preimages
for _, dirty := range csdb.journal.dirties {
for i, dirty := range csdb.journal.dirties {
// 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.
//
// Ref: https://github.com/ethereum/go-ethereum/pull/16485#issuecomment-380438527
if idx, exist := csdb.addressToObjectIndex[dirty.address]; exist {
state.stateObjects[idx] = stateEntry{
state.stateObjects[i] = stateEntry{
address: dirty.address,
stateObject: csdb.stateObjects[idx].stateObject.deepCopy(state),
}