From 2f9ed3c6b064465057a47a6e1fed341ff51354a1 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Tue, 7 Jul 2020 10:26:02 +0200 Subject: [PATCH] vm -> tangerineWhistle: only delete touched accounts on spuriousDragon or later (EIP-161) --- packages/vm/lib/state/stateManager.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/vm/lib/state/stateManager.ts b/packages/vm/lib/state/stateManager.ts index b9b7fd6588..c7e08bda9f 100644 --- a/packages/vm/lib/state/stateManager.ts +++ b/packages/vm/lib/state/stateManager.ts @@ -482,12 +482,14 @@ export default class DefaultStateManager implements StateManager { * as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161). */ async cleanupTouchedAccounts(): Promise { - const touchedArray = Array.from(this._touched) - for (const addressHex of touchedArray) { - const address = Buffer.from(addressHex, 'hex') - const empty = await this.accountIsEmpty(address) - if (empty) { - this._cache.del(address) + if (this._common.gteHardfork('spuriousDragon')) { + const touchedArray = Array.from(this._touched) + for (const addressHex of touchedArray) { + const address = Buffer.from(addressHex, 'hex') + const empty = await this.accountIsEmpty(address) + if (empty) { + this._cache.del(address) + } } } this._touched.clear()