aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gen_btheader.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-04-08 21:16:05 +0800
committerGitHub <noreply@github.com>2019-04-08 21:16:05 +0800
commit4e13a09c5033b4cf073db6aeaaa7d159dcf07f30 (patch)
tree0f64daac335200ce6fd45d6ee9f62dabc0fb1887 /tests/gen_btheader.go
parentc942700427557e3ff6de3aaf6b916e2f056c1ec2 (diff)
parent009d2fe2d650b1a92e28f0decbf5f7fa628779e9 (diff)
downloadgo-tangerine-1.8.24.tar
go-tangerine-1.8.24.tar.gz
go-tangerine-1.8.24.tar.bz2
go-tangerine-1.8.24.tar.lz
go-tangerine-1.8.24.tar.xz
go-tangerine-1.8.24.tar.zst
go-tangerine-1.8.24.zip
Merge pull request #19370 from karalabe/geth-1.8.24v1.8.24
Backport PR for the v1.8.24 maintenance release
Diffstat (limited to 'tests/gen_btheader.go')
-rw-r--r--tests/gen_btheader.go10
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
}