mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
fix StructLog (#672)
This commit is contained in:
parent
4ebc036d75
commit
badcd0c432
1 changed files with 7 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
|
@ -29,6 +30,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
|||
Depth int `json:"depth"`
|
||||
RefundCounter uint64 `json:"refund"`
|
||||
Err error `json:"-"`
|
||||
ExtraData *types.ExtraData `json:"extraData"`
|
||||
OpName string `json:"opName"`
|
||||
ErrorString string `json:"error,omitempty"`
|
||||
}
|
||||
|
|
@ -45,6 +47,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
|||
enc.Depth = s.Depth
|
||||
enc.RefundCounter = s.RefundCounter
|
||||
enc.Err = s.Err
|
||||
enc.ExtraData = s.ExtraData
|
||||
enc.OpName = s.OpName()
|
||||
enc.ErrorString = s.ErrorString()
|
||||
return json.Marshal(&enc)
|
||||
|
|
@ -65,6 +68,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
|||
Depth *int `json:"depth"`
|
||||
RefundCounter *uint64 `json:"refund"`
|
||||
Err error `json:"-"`
|
||||
ExtraData *types.ExtraData `json:"extraData"`
|
||||
}
|
||||
var dec StructLog
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
|
@ -106,5 +110,8 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
|||
if dec.Err != nil {
|
||||
s.Err = dec.Err
|
||||
}
|
||||
if dec.ExtraData != nil {
|
||||
s.ExtraData = dec.ExtraData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue