mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
core/types: block timestamp in log should encode as hex
This commit is contained in:
parent
cc8d58fdc0
commit
49d414e975
10 changed files with 17 additions and 16 deletions
|
|
@ -22,7 +22,7 @@ func (l Log) MarshalJSON() ([]byte, error) {
|
||||||
TxHash common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
|
TxHash common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
|
||||||
TxIndex hexutil.Uint `json:"transactionIndex" rlp:"-"`
|
TxIndex hexutil.Uint `json:"transactionIndex" rlp:"-"`
|
||||||
BlockHash common.Hash `json:"blockHash" rlp:"-"`
|
BlockHash common.Hash `json:"blockHash" rlp:"-"`
|
||||||
BlockTimestamp uint64 `json:"blockTimestamp" rlp:"-"`
|
BlockTimestamp hexutil.Uint64 `json:"blockTimestamp" rlp:"-"`
|
||||||
Index hexutil.Uint `json:"logIndex" rlp:"-"`
|
Index hexutil.Uint `json:"logIndex" rlp:"-"`
|
||||||
Removed bool `json:"removed" rlp:"-"`
|
Removed bool `json:"removed" rlp:"-"`
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ func (l Log) MarshalJSON() ([]byte, error) {
|
||||||
enc.TxHash = l.TxHash
|
enc.TxHash = l.TxHash
|
||||||
enc.TxIndex = hexutil.Uint(l.TxIndex)
|
enc.TxIndex = hexutil.Uint(l.TxIndex)
|
||||||
enc.BlockHash = l.BlockHash
|
enc.BlockHash = l.BlockHash
|
||||||
enc.BlockTimestamp = l.BlockTimestamp
|
enc.BlockTimestamp = hexutil.Uint64(l.BlockTimestamp)
|
||||||
enc.Index = hexutil.Uint(l.Index)
|
enc.Index = hexutil.Uint(l.Index)
|
||||||
enc.Removed = l.Removed
|
enc.Removed = l.Removed
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
|
|
@ -50,7 +50,7 @@ func (l *Log) UnmarshalJSON(input []byte) error {
|
||||||
TxHash *common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
|
TxHash *common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
|
||||||
TxIndex *hexutil.Uint `json:"transactionIndex" rlp:"-"`
|
TxIndex *hexutil.Uint `json:"transactionIndex" rlp:"-"`
|
||||||
BlockHash *common.Hash `json:"blockHash" rlp:"-"`
|
BlockHash *common.Hash `json:"blockHash" rlp:"-"`
|
||||||
BlockTimestamp *uint64 `json:"blockTimestamp" rlp:"-"`
|
BlockTimestamp *hexutil.Uint64 `json:"blockTimestamp" rlp:"-"`
|
||||||
Index *hexutil.Uint `json:"logIndex" rlp:"-"`
|
Index *hexutil.Uint `json:"logIndex" rlp:"-"`
|
||||||
Removed *bool `json:"removed" rlp:"-"`
|
Removed *bool `json:"removed" rlp:"-"`
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ func (l *Log) UnmarshalJSON(input []byte) error {
|
||||||
l.BlockHash = *dec.BlockHash
|
l.BlockHash = *dec.BlockHash
|
||||||
}
|
}
|
||||||
if dec.BlockTimestamp != nil {
|
if dec.BlockTimestamp != nil {
|
||||||
l.BlockTimestamp = *dec.BlockTimestamp
|
l.BlockTimestamp = uint64(*dec.BlockTimestamp)
|
||||||
}
|
}
|
||||||
if dec.Index != nil {
|
if dec.Index != nil {
|
||||||
l.Index = uint(*dec.Index)
|
l.Index = uint(*dec.Index)
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,6 @@ type logMarshaling struct {
|
||||||
Data hexutil.Bytes
|
Data hexutil.Bytes
|
||||||
BlockNumber hexutil.Uint64
|
BlockNumber hexutil.Uint64
|
||||||
TxIndex hexutil.Uint
|
TxIndex hexutil.Uint
|
||||||
|
BlockTimestamp hexutil.Uint64
|
||||||
Index hexutil.Uint
|
Index hexutil.Uint
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
||||||
"transactionIndex": "0x0",
|
"transactionIndex": "0x0",
|
||||||
"blockHash": "0xcc6225bf39327429a3d869af71182d619a354155187d0b5a8ecd6a9309cffcaa",
|
"blockHash": "0xcc6225bf39327429a3d869af71182d619a354155187d0b5a8ecd6a9309cffcaa",
|
||||||
"blockTimestamp": 30,
|
"blockTimestamp": "0x1e",
|
||||||
"logIndex": "0x0",
|
"logIndex": "0x0",
|
||||||
"removed": false
|
"removed": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
||||||
"transactionIndex": "0x0",
|
"transactionIndex": "0x0",
|
||||||
"blockHash": "0xcc6225bf39327429a3d869af71182d619a354155187d0b5a8ecd6a9309cffcaa",
|
"blockHash": "0xcc6225bf39327429a3d869af71182d619a354155187d0b5a8ecd6a9309cffcaa",
|
||||||
"blockTimestamp": 30,
|
"blockTimestamp": "0x1e",
|
||||||
"logIndex": "0x0",
|
"logIndex": "0x0",
|
||||||
"removed": false
|
"removed": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue