Skip to content

Commit

Permalink
vm -> tangerineWhistle: only delete touched accounts on spuriousDrago…
Browse files Browse the repository at this point in the history
…n or later (EIP-161)
  • Loading branch information
holgerd77 committed Jul 7, 2020
1 parent a2a2354 commit 2f9ed3c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/vm/lib/state/stateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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()
Expand Down

0 comments on commit 2f9ed3c

Please sign in to comment.