2017-09-27 08:30:41 -05:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
package tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"math/big"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/common/math"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = (*difficultyTestMarshaling)(nil)
|
|
|
|
|
2019-04-02 15:28:48 -05:00
|
|
|
// MarshalJSON marshals as JSON.
|
2017-09-27 08:30:41 -05:00
|
|
|
func (d DifficultyTest) MarshalJSON() ([]byte, error) {
|
|
|
|
type DifficultyTest struct {
|
2019-04-02 15:28:48 -05:00
|
|
|
ParentTimestamp math.HexOrDecimal64 `json:"parentTimestamp"`
|
2017-09-27 08:30:41 -05:00
|
|
|
ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"`
|
|
|
|
UncleHash common.Hash `json:"parentUncles"`
|
2019-04-02 15:28:48 -05:00
|
|
|
CurrentTimestamp math.HexOrDecimal64 `json:"currentTimestamp"`
|
2017-09-27 08:30:41 -05:00
|
|
|
CurrentBlockNumber math.HexOrDecimal64 `json:"currentBlockNumber"`
|
|
|
|
CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"`
|
|
|
|
}
|
|
|
|
var enc DifficultyTest
|
2019-04-02 15:28:48 -05:00
|
|
|
enc.ParentTimestamp = math.HexOrDecimal64(d.ParentTimestamp)
|
2017-09-27 08:30:41 -05:00
|
|
|
enc.ParentDifficulty = (*math.HexOrDecimal256)(d.ParentDifficulty)
|
|
|
|
enc.UncleHash = d.UncleHash
|
2019-04-02 15:28:48 -05:00
|
|
|
enc.CurrentTimestamp = math.HexOrDecimal64(d.CurrentTimestamp)
|
2017-09-27 08:30:41 -05:00
|
|
|
enc.CurrentBlockNumber = math.HexOrDecimal64(d.CurrentBlockNumber)
|
|
|
|
enc.CurrentDifficulty = (*math.HexOrDecimal256)(d.CurrentDifficulty)
|
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
2019-04-02 15:28:48 -05:00
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
2017-09-27 08:30:41 -05:00
|
|
|
func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
|
|
|
|
type DifficultyTest struct {
|
2019-04-02 15:28:48 -05:00
|
|
|
ParentTimestamp *math.HexOrDecimal64 `json:"parentTimestamp"`
|
2017-09-27 08:30:41 -05:00
|
|
|
ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"`
|
|
|
|
UncleHash *common.Hash `json:"parentUncles"`
|
2019-04-02 15:28:48 -05:00
|
|
|
CurrentTimestamp *math.HexOrDecimal64 `json:"currentTimestamp"`
|
2017-09-27 08:30:41 -05:00
|
|
|
CurrentBlockNumber *math.HexOrDecimal64 `json:"currentBlockNumber"`
|
|
|
|
CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"`
|
|
|
|
}
|
|
|
|
var dec DifficultyTest
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.ParentTimestamp != nil {
|
2019-04-02 15:28:48 -05:00
|
|
|
d.ParentTimestamp = uint64(*dec.ParentTimestamp)
|
2017-09-27 08:30:41 -05:00
|
|
|
}
|
|
|
|
if dec.ParentDifficulty != nil {
|
|
|
|
d.ParentDifficulty = (*big.Int)(dec.ParentDifficulty)
|
|
|
|
}
|
|
|
|
if dec.UncleHash != nil {
|
|
|
|
d.UncleHash = *dec.UncleHash
|
|
|
|
}
|
|
|
|
if dec.CurrentTimestamp != nil {
|
2019-04-02 15:28:48 -05:00
|
|
|
d.CurrentTimestamp = uint64(*dec.CurrentTimestamp)
|
2017-09-27 08:30:41 -05:00
|
|
|
}
|
|
|
|
if dec.CurrentBlockNumber != nil {
|
|
|
|
d.CurrentBlockNumber = uint64(*dec.CurrentBlockNumber)
|
|
|
|
}
|
|
|
|
if dec.CurrentDifficulty != nil {
|
|
|
|
d.CurrentDifficulty = (*big.Int)(dec.CurrentDifficulty)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|