diff options
Diffstat (limited to 'tests/gen_btheader.go')
-rw-r--r-- | tests/gen_btheader.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/gen_btheader.go b/tests/gen_btheader.go index 5cfd4bd0a..f2e086a7b 100644 --- a/tests/gen_btheader.go +++ b/tests/gen_btheader.go @@ -14,6 +14,7 @@ import ( var _ = (*btHeaderMarshaling)(nil) +// MarshalJSON marshals as JSON. func (b btHeader) MarshalJSON() ([]byte, error) { type btHeader struct { Bloom types.Bloom @@ -31,7 +32,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) { Difficulty *math.HexOrDecimal256 GasLimit math.HexOrDecimal64 GasUsed math.HexOrDecimal64 - Timestamp *math.HexOrDecimal256 + Timestamp math.HexOrDecimal64 } var enc btHeader enc.Bloom = b.Bloom @@ -49,10 +50,11 @@ func (b btHeader) MarshalJSON() ([]byte, error) { enc.Difficulty = (*math.HexOrDecimal256)(b.Difficulty) enc.GasLimit = math.HexOrDecimal64(b.GasLimit) enc.GasUsed = math.HexOrDecimal64(b.GasUsed) - enc.Timestamp = (*math.HexOrDecimal256)(b.Timestamp) + enc.Timestamp = math.HexOrDecimal64(b.Timestamp) return json.Marshal(&enc) } +// UnmarshalJSON unmarshals from JSON. func (b *btHeader) UnmarshalJSON(input []byte) error { type btHeader struct { Bloom *types.Bloom @@ -70,7 +72,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { Difficulty *math.HexOrDecimal256 GasLimit *math.HexOrDecimal64 GasUsed *math.HexOrDecimal64 - Timestamp *math.HexOrDecimal256 + Timestamp *math.HexOrDecimal64 } var dec btHeader if err := json.Unmarshal(input, &dec); err != nil { @@ -122,7 +124,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { b.GasUsed = uint64(*dec.GasUsed) } if dec.Timestamp != nil { - b.Timestamp = (*big.Int)(dec.Timestamp) + b.Timestamp = uint64(*dec.Timestamp) } return nil } |