diff options
Diffstat (limited to 'tests/gen_difficultytest.go')
-rw-r--r-- | tests/gen_difficultytest.go | 18 |
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) |