From a6e152bbb68ca84495319a836f2708894d6885fa Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Mon, 31 Aug 2020 08:59:47 -0600 Subject: [PATCH] fix csdb.Copy (#488) --- x/evm/types/statedb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/evm/types/statedb.go b/x/evm/types/statedb.go index 95b96b76..3fdc0b33 100644 --- a/x/evm/types/statedb.go +++ b/x/evm/types/statedb.go @@ -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), }