eth: returned revert reason in traceTx (#21195)

* eth: returned revert reason in traceTx

* eth: return result data
pull/21269/head
Marius van der Wijden 4 years ago committed by GitHub
parent 413358abb9
commit 02cea2330d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      eth/api_tracer.go

@ -765,10 +765,15 @@ func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, v
// Depending on the tracer type, format and return the output
switch tracer := tracer.(type) {
case *vm.StructLogger:
// If the result contains a revert reason, return it.
returnVal := fmt.Sprintf("%x", result.Return())
if len(result.Revert()) > 0 {
returnVal = fmt.Sprintf("%x", result.Revert())
}
return &ethapi.ExecutionResult{
Gas: result.UsedGas,
Failed: result.Failed(),
ReturnValue: fmt.Sprintf("%x", result.Return()),
ReturnValue: returnVal,
StructLogs: ethapi.FormatLogs(tracer.StructLogs()),
}, nil

Loading…
Cancel
Save