From bfa0f96822c310759394640dc2965fceb091a3a4 Mon Sep 17 00:00:00 2001 From: cdetrio Date: Thu, 4 Oct 2018 04:22:41 -0400 Subject: cmd/evm: fix state dump (#17832) --- cmd/evm/staterunner.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 6d5ff069f..06c9be380 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -97,6 +97,10 @@ func stateTestCmd(ctx *cli.Context) error { // Run the test and aggregate the result result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true} state, err := test.Run(st, cfg) + // print state root for evmlab tracing + if ctx.GlobalBool(MachineFlag.Name) && state != nil { + fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false)) + } if err != nil { // Test failed, mark as so and dump any state to aid debugging result.Pass, result.Error = false, err.Error() @@ -105,10 +109,6 @@ func stateTestCmd(ctx *cli.Context) error { result.State = &dump } } - // print state root for evmlab tracing (already committed above, so no need to delete objects again - if ctx.GlobalBool(MachineFlag.Name) && state != nil { - fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false)) - } results = append(results, *result) -- cgit v1.2.3