eth/tracers: fix

This commit is contained in:
Sina Mahmoodi 2021-10-13 15:03:38 +02:00
parent 7b105349c5
commit ca5427ade0
1 changed files with 18 additions and 17 deletions

View File

@ -19,7 +19,7 @@ func init() {
type CallFrame struct { type CallFrame struct {
Type string `json:"type"` Type string `json:"type"`
From string `json:"from"` From string `json:"from"`
To string `json:"to"` To string `json:"to,omitempty"`
Value string `json:"value,omitempty"` Value string `json:"value,omitempty"`
Gas string `json:"gas"` Gas string `json:"gas"`
GasUsed string `json:"gasUsed"` GasUsed string `json:"gasUsed"`
@ -82,7 +82,9 @@ func (t *CallTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.
func (t *CallTracer) CaptureExit(output []byte, gasUsed uint64, err error) { func (t *CallTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
size := len(t.callstack) size := len(t.callstack)
if size > 1 { if size <= 1 {
return
}
// pop call // pop call
call := t.callstack[size-1] call := t.callstack[size-1]
t.callstack = t.callstack[:size-1] t.callstack = t.callstack[:size-1]
@ -99,7 +101,6 @@ func (t *CallTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
} }
t.callstack[size-1].Calls = append(t.callstack[size-1].Calls, call) t.callstack[size-1].Calls = append(t.callstack[size-1].Calls, call)
} }
}
func (t *CallTracer) GetResult() (json.RawMessage, error) { func (t *CallTracer) GetResult() (json.RawMessage, error) {
if len(t.callstack) != 1 { if len(t.callstack) != 1 {