diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-03 23:20:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-03 23:20:38 +0800 |
commit | c74c07eed19f8a328f47aca7b9e01dcdf8731847 (patch) | |
tree | f5c7ed0bdae761d00521f3987bd92497d1d035a2 /tests | |
parent | 6518da7c0123168061b97e259e75a39c7f6b1638 (diff) | |
download | dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar.gz dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar.bz2 dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar.lz dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar.xz dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.tar.zst dexon-c74c07eed19f8a328f47aca7b9e01dcdf8731847.zip |
Fixed error for invalid transaction
Diffstat (limited to 'tests')
-rw-r--r-- | tests/helper/vm.go | 4 | ||||
-rw-r--r-- | tests/vm/gh_test.go | 6 |
2 files changed, 5 insertions, 5 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 diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 64e858280..a3eb93616 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,10 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - helper.Logger.SetLogLevel(4) - if name != "callcodeToNameRegistratorAddresTooBigRight" { - continue - } db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { @@ -161,7 +157,7 @@ func RunVmTest(p string, t *testing.T) { if !isVmTest { if !bytes.Equal(ethutil.Hex2Bytes(test.PostStateRoot), statedb.Root()) { - //t.Errorf("%s's : Post state root error. Expected %s, got %x", name, test.PostStateRoot, statedb.Root()) + t.Errorf("%s's : Post state root error. Expected %s, got %x", name, test.PostStateRoot, statedb.Root()) } } |