From 340c7732016d5c429ede22751d90d98d0609601b Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Tue, 12 Oct 2021 12:43:34 +0200 Subject: [PATCH] eth/tracers: fix call tracer json result --- eth/tracers/native/call.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/tracers/native/call.go b/eth/tracers/native/call.go index 923fd052c1..22f0f2ccaf 100644 --- a/eth/tracers/native/call.go +++ b/eth/tracers/native/call.go @@ -2,6 +2,7 @@ package native import ( "encoding/json" + "errors" "math/big" "strconv" "strings" @@ -101,7 +102,10 @@ func (t *CallTracer) CaptureExit(output []byte, gasUsed uint64, err error) { } func (t *CallTracer) GetResult() (json.RawMessage, error) { - res, err := json.Marshal(t.callstack) + if len(t.callstack) != 1 { + return nil, errors.New("incorrect number of top-level calls") + } + res, err := json.Marshal(t.callstack[0]) if err != nil { return nil, err }