aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gen_difficultytest.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2019-04-03 04:28:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-04-08 17:00:42 +0800
commitaf401d03a395c21fdb297edb687edf8af3470cb2 (patch)
treed2ee3476c9005ffe1aca7abbe7152765da0efe32 /tests/gen_difficultytest.go
parent80a2a35bc3aaf208b5f91a1fb1d803975d4bb01c (diff)
downloadgo-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar.gz
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar.bz2
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar.lz
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar.xz
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.tar.zst
go-tangerine-af401d03a395c21fdb297edb687edf8af3470cb2.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_difficultytest.go')
-rw-r--r--tests/gen_difficultytest.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/gen_difficultytest.go b/tests/gen_difficultytest.go
index 88f36ce99..cd15ae31b 100644
--- a/tests/gen_difficultytest.go
+++ b/tests/gen_difficultytest.go
@@ -12,31 +12,33 @@ import (
var _ = (*difficultyTestMarshaling)(nil)
+// MarshalJSON marshals as JSON.
func (d DifficultyTest) MarshalJSON() ([]byte, error) {
type DifficultyTest struct {
- ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
+ ParentTimestamp math.HexOrDecimal64 `json:"parentTimestamp"`
ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"`
UncleHash common.Hash `json:"parentUncles"`
- CurrentTimestamp *math.HexOrDecimal256 `json:"currentTimestamp"`
+ CurrentTimestamp math.HexOrDecimal64 `json:"currentTimestamp"`
CurrentBlockNumber math.HexOrDecimal64 `json:"currentBlockNumber"`
CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"`
}
var enc DifficultyTest
- enc.ParentTimestamp = (*math.HexOrDecimal256)(d.ParentTimestamp)
+ enc.ParentTimestamp = math.HexOrDecimal64(d.ParentTimestamp)
enc.ParentDifficulty = (*math.HexOrDecimal256)(d.ParentDifficulty)
enc.UncleHash = d.UncleHash
- enc.CurrentTimestamp = (*math.HexOrDecimal256)(d.CurrentTimestamp)
+ enc.CurrentTimestamp = math.HexOrDecimal64(d.CurrentTimestamp)
enc.CurrentBlockNumber = math.HexOrDecimal64(d.CurrentBlockNumber)
enc.CurrentDifficulty = (*math.HexOrDecimal256)(d.CurrentDifficulty)
return json.Marshal(&enc)
}
+// UnmarshalJSON unmarshals from JSON.
func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
type DifficultyTest struct {
- ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
+ ParentTimestamp *math.HexOrDecimal64 `json:"parentTimestamp"`
ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"`
UncleHash *common.Hash `json:"parentUncles"`
- CurrentTimestamp *math.HexOrDecimal256 `json:"currentTimestamp"`
+ CurrentTimestamp *math.HexOrDecimal64 `json:"currentTimestamp"`
CurrentBlockNumber *math.HexOrDecimal64 `json:"currentBlockNumber"`
CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"`
}
@@ -45,7 +47,7 @@ func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
return err
}
if dec.ParentTimestamp != nil {
- d.ParentTimestamp = (*big.Int)(dec.ParentTimestamp)
+ d.ParentTimestamp = uint64(*dec.ParentTimestamp)
}
if dec.ParentDifficulty != nil {
d.ParentDifficulty = (*big.Int)(dec.ParentDifficulty)
@@ -54,7 +56,7 @@ func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
d.UncleHash = *dec.UncleHash
}
if dec.CurrentTimestamp != nil {
- d.CurrentTimestamp = (*big.Int)(dec.CurrentTimestamp)
+ d.CurrentTimestamp = uint64(*dec.CurrentTimestamp)
}
if dec.CurrentBlockNumber != nil {
d.CurrentBlockNumber = uint64(*dec.CurrentBlockNumber)