From 355244b5bc3bb2fe8f686a2572cafd2113084d18 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 3 Oct 2018 11:07:55 -0400 Subject: [PATCH] Implement deepCopy on state object --- state/state_object.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/state/state_object.go b/state/state_object.go index 5fdc40a5..bc01f8ee 100644 --- a/state/state_object.go +++ b/state/state_object.go @@ -275,6 +275,19 @@ func (so *stateObject) getCommittedState(ctx sdk.Context, key ethcmn.Hash) ethcm // Closures. It performs a no-op. func (so *stateObject) ReturnGas(gas *big.Int) {} +func (so *stateObject) deepCopy(db *CommitStateDB) *stateObject { + newStateObj := newObject(db, so.account) + + newStateObj.code = so.code + newStateObj.dirtyStorage = so.dirtyStorage.Copy() + newStateObj.originStorage = so.originStorage.Copy() + newStateObj.suicided = so.suicided + newStateObj.dirtyCode = so.dirtyCode + newStateObj.deleted = so.deleted + + return newStateObj +} + // empty returns whether the account is considered empty. func (so *stateObject) empty() bool { return so.account.Sequence == 0 &&