aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helper
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helper')
-rw-r--r--tests/helper/vm.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index 8811936fa..9ebf8f8b6 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -167,6 +167,7 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
// Set pre compiled contracts
vm.Precompiled = vm.PrecompiledContracts()
+ snapshot := statedb.Copy()
coinbase := statedb.GetOrNewStateObject(caddr)
coinbase.SetGasPool(ethutil.Big(env["currentGasLimit"]))
@@ -175,6 +176,9 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
st := core.NewStateTransition(vmenv, message, coinbase)
vmenv.origin = keyPair.Address()
ret, err := st.TransitionState()
+ if core.IsNonceErr(err) || core.IsInvalidTxErr(err) {
+ statedb.Set(snapshot)
+ }
statedb.Update(vmenv.Gas)
return ret, vmenv.logs, vmenv.Gas, err