From 70dd74ae2dc822b53116fad2472c6270d7204113 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 16 Nov 2018 14:12:48 +0000 Subject: [PATCH] Reset selfdestruct on revert Fixes test TouchToEmptyAccountRevert3 on Constantinople --- lib/opFns.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/opFns.js b/lib/opFns.js index df6a88c21b..3811bd116f 100644 --- a/lib/opFns.js +++ b/lib/opFns.js @@ -988,12 +988,13 @@ function checkOutOfGas (runState, callOptions) { // sets up and calls runCall function makeCall (runState, callOptions, localOpts, cb) { + var selfdestruct = Object.assign({}, runState.selfdestruct) callOptions.caller = callOptions.caller || runState.address callOptions.origin = runState.origin callOptions.gasPrice = runState.gasPrice callOptions.block = runState.block callOptions.static = callOptions.static || false - callOptions.selfdestruct = runState.selfdestruct + callOptions.selfdestruct = selfdestruct callOptions.storageReader = runState.storageReader // increment the runState.depth @@ -1053,6 +1054,7 @@ function makeCall (runState, callOptions, localOpts, cb) { } if (!results.vm.exceptionError) { + Object.assign(runState.selfdestruct, selfdestruct) // update stateRoot on current contract runState.stateManager.getAccount(runState.address, function (err, account) { if (err) return cb(err)