mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-16 20:01:37 +00:00
eth/tracers/logger: use omitzero for legacy error omission
Use a plain string field with omitzero for the legacy structLog error field so the JSON shape stays unchanged without pointer indirection.
This commit is contained in:
parent
957e1ed413
commit
fd461323fc
1 changed files with 2 additions and 4 deletions
|
|
@ -148,7 +148,7 @@ type structLogLegacy struct {
|
||||||
Gas uint64 `json:"gas"`
|
Gas uint64 `json:"gas"`
|
||||||
GasCost uint64 `json:"gasCost"`
|
GasCost uint64 `json:"gasCost"`
|
||||||
Depth int `json:"depth"`
|
Depth int `json:"depth"`
|
||||||
Error *string `json:"error,omitempty"`
|
Error string `json:"error,omitempty,omitzero"`
|
||||||
Stack *[]string `json:"stack,omitempty"`
|
Stack *[]string `json:"stack,omitempty"`
|
||||||
ReturnData string `json:"returnData,omitempty"`
|
ReturnData string `json:"returnData,omitempty"`
|
||||||
Memory *[]string `json:"memory,omitempty"`
|
Memory *[]string `json:"memory,omitempty"`
|
||||||
|
|
@ -173,11 +173,9 @@ func (s *StructLog) toLegacyJSON() json.RawMessage {
|
||||||
Gas: s.Gas,
|
Gas: s.Gas,
|
||||||
GasCost: s.GasCost,
|
GasCost: s.GasCost,
|
||||||
Depth: s.Depth,
|
Depth: s.Depth,
|
||||||
|
Error: s.ErrorString(),
|
||||||
RefundCounter: s.RefundCounter,
|
RefundCounter: s.RefundCounter,
|
||||||
}
|
}
|
||||||
if err := s.ErrorString(); err != "" {
|
|
||||||
msg.Error = &err
|
|
||||||
}
|
|
||||||
if s.Stack != nil {
|
if s.Stack != nil {
|
||||||
stack := make([]string, len(s.Stack))
|
stack := make([]string, len(s.Stack))
|
||||||
for i, stackValue := range s.Stack {
|
for i, stackValue := range s.Stack {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue