diff options
author | Martin Holst Swende <martin@swende.se> | 2019-04-03 04:28:48 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-04-03 04:28:48 +0800 |
commit | 0b4fe8d1929ad64ed576f7560dde4179d71ecfcb (patch) | |
tree | 923d7b795c59ddb0e5d338f2b2e6536e00a58c88 /tests/gen_btheader.go | |
parent | e14f8a408c17fd6c57d769cd4635ad6cc8bde769 (diff) | |
download | go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.gz go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.bz2 go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.lz go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.xz go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.zst go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.zip |
all: simplify timestamps to uint64 (#19372)
* all: simplify timestamps to uint64
* tests: update definitions
* clef, faucet, mobile: leftover uint64 fixups
* ethash: fix tests
* graphql: update schema for timestamp
* ethash: remove unused variable
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 } |