From 94903d572b4ee72c7ea62ce9856f51def85fdd2a Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Thu, 24 Aug 2017 11:18:21 +0800 Subject: internal, accounts, eth: utilize vm failed flag to help gas estimation --- eth/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'eth/api.go') diff --git a/eth/api.go b/eth/api.go index d64e4e6c7..e91f51bb9 100644 --- a/eth/api.go +++ b/eth/api.go @@ -523,8 +523,7 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common. // Run the transaction with tracing enabled. vmenv := vm.NewEVM(context, statedb, api.config, vm.Config{Debug: true, Tracer: tracer}) - // TODO utilize failed flag - ret, gas, _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())) + ret, gas, failed, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())) if err != nil { return nil, fmt.Errorf("tracing failed: %v", err) } @@ -532,6 +531,7 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common. case *vm.StructLogger: return ðapi.ExecutionResult{ Gas: gas, + Failed: failed, ReturnValue: fmt.Sprintf("%x", ret), StructLogs: ethapi.FormatLogs(tracer.StructLogs()), }, nil -- cgit v1.2.3