Call with no subcalls is nil instead of empty array for backwards compatibility

This commit is contained in:
Geoff Stuart 2022-06-03 15:15:00 -04:00
parent 8212b2c5d9
commit 0c789b06dc

View File

@ -63,14 +63,16 @@ func (t *FvmExecutionTrace) ToExecutionTrace() types.ExecutionTrace {
Msg: t.Msg,
MsgRct: t.MsgRct,
Error: t.Error,
Duration: 0,
GasCharges: nil,
Subcalls: make([]types.ExecutionTrace, len(t.Subcalls)),
Subcalls: nil, // Should be nil when there are no subcalls for backwards compatibility
}
if len(t.Subcalls) > 0 {
ret.Subcalls = make([]types.ExecutionTrace, len(t.Subcalls))
for i, v := range t.Subcalls {
ret.Subcalls[i] = v.ToExecutionTrace()
}
}
return ret
}