2017-07-11 14:49:14 +03: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/hexutil"
|
|
|
|
"github.com/ethereum/go-ethereum/common/math"
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = (*btHeaderMarshaling)(nil)
|
|
|
|
|
2019-04-02 23:28:48 +03:00
|
|
|
// MarshalJSON marshals as JSON.
|
2017-07-11 14:49:14 +03:00
|
|
|
func (b btHeader) MarshalJSON() ([]byte, error) {
|
|
|
|
type btHeader struct {
|
2023-08-26 16:42:27 +03:00
|
|
|
Bloom types.Bloom
|
|
|
|
Coinbase common.Address
|
|
|
|
MixHash common.Hash
|
|
|
|
Nonce types.BlockNonce
|
|
|
|
Number *math.HexOrDecimal256
|
|
|
|
Hash common.Hash
|
|
|
|
ParentHash common.Hash
|
|
|
|
ReceiptTrie common.Hash
|
|
|
|
StateRoot common.Hash
|
|
|
|
TransactionsTrie common.Hash
|
|
|
|
UncleHash common.Hash
|
|
|
|
ExtraData hexutil.Bytes
|
|
|
|
Difficulty *math.HexOrDecimal256
|
|
|
|
GasLimit math.HexOrDecimal64
|
|
|
|
GasUsed math.HexOrDecimal64
|
|
|
|
Timestamp math.HexOrDecimal64
|
|
|
|
BaseFeePerGas *math.HexOrDecimal256
|
|
|
|
WithdrawalsRoot *common.Hash
|
|
|
|
BlobGasUsed *math.HexOrDecimal64
|
|
|
|
ExcessBlobGas *math.HexOrDecimal64
|
|
|
|
ParentBeaconBlockRoot *common.Hash
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
|
|
|
var enc btHeader
|
|
|
|
enc.Bloom = b.Bloom
|
|
|
|
enc.Coinbase = b.Coinbase
|
|
|
|
enc.MixHash = b.MixHash
|
|
|
|
enc.Nonce = b.Nonce
|
|
|
|
enc.Number = (*math.HexOrDecimal256)(b.Number)
|
|
|
|
enc.Hash = b.Hash
|
|
|
|
enc.ParentHash = b.ParentHash
|
|
|
|
enc.ReceiptTrie = b.ReceiptTrie
|
|
|
|
enc.StateRoot = b.StateRoot
|
|
|
|
enc.TransactionsTrie = b.TransactionsTrie
|
|
|
|
enc.UncleHash = b.UncleHash
|
|
|
|
enc.ExtraData = b.ExtraData
|
|
|
|
enc.Difficulty = (*math.HexOrDecimal256)(b.Difficulty)
|
2018-01-08 15:15:57 +03:00
|
|
|
enc.GasLimit = math.HexOrDecimal64(b.GasLimit)
|
|
|
|
enc.GasUsed = math.HexOrDecimal64(b.GasUsed)
|
2019-04-02 23:28:48 +03:00
|
|
|
enc.Timestamp = math.HexOrDecimal64(b.Timestamp)
|
2021-07-29 15:05:22 +03:00
|
|
|
enc.BaseFeePerGas = (*math.HexOrDecimal256)(b.BaseFeePerGas)
|
2023-02-06 22:52:51 +03:00
|
|
|
enc.WithdrawalsRoot = b.WithdrawalsRoot
|
2023-08-26 16:42:27 +03:00
|
|
|
enc.BlobGasUsed = (*math.HexOrDecimal64)(b.BlobGasUsed)
|
|
|
|
enc.ExcessBlobGas = (*math.HexOrDecimal64)(b.ExcessBlobGas)
|
|
|
|
enc.ParentBeaconBlockRoot = b.ParentBeaconBlockRoot
|
2017-07-11 14:49:14 +03:00
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
2019-04-02 23:28:48 +03:00
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
2017-07-11 14:49:14 +03:00
|
|
|
func (b *btHeader) UnmarshalJSON(input []byte) error {
|
|
|
|
type btHeader struct {
|
2023-08-26 16:42:27 +03:00
|
|
|
Bloom *types.Bloom
|
|
|
|
Coinbase *common.Address
|
|
|
|
MixHash *common.Hash
|
|
|
|
Nonce *types.BlockNonce
|
|
|
|
Number *math.HexOrDecimal256
|
|
|
|
Hash *common.Hash
|
|
|
|
ParentHash *common.Hash
|
|
|
|
ReceiptTrie *common.Hash
|
|
|
|
StateRoot *common.Hash
|
|
|
|
TransactionsTrie *common.Hash
|
|
|
|
UncleHash *common.Hash
|
|
|
|
ExtraData *hexutil.Bytes
|
|
|
|
Difficulty *math.HexOrDecimal256
|
|
|
|
GasLimit *math.HexOrDecimal64
|
|
|
|
GasUsed *math.HexOrDecimal64
|
|
|
|
Timestamp *math.HexOrDecimal64
|
|
|
|
BaseFeePerGas *math.HexOrDecimal256
|
|
|
|
WithdrawalsRoot *common.Hash
|
|
|
|
BlobGasUsed *math.HexOrDecimal64
|
|
|
|
ExcessBlobGas *math.HexOrDecimal64
|
|
|
|
ParentBeaconBlockRoot *common.Hash
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
|
|
|
var dec btHeader
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.Bloom != nil {
|
|
|
|
b.Bloom = *dec.Bloom
|
|
|
|
}
|
|
|
|
if dec.Coinbase != nil {
|
|
|
|
b.Coinbase = *dec.Coinbase
|
|
|
|
}
|
|
|
|
if dec.MixHash != nil {
|
|
|
|
b.MixHash = *dec.MixHash
|
|
|
|
}
|
|
|
|
if dec.Nonce != nil {
|
|
|
|
b.Nonce = *dec.Nonce
|
|
|
|
}
|
|
|
|
if dec.Number != nil {
|
|
|
|
b.Number = (*big.Int)(dec.Number)
|
|
|
|
}
|
|
|
|
if dec.Hash != nil {
|
|
|
|
b.Hash = *dec.Hash
|
|
|
|
}
|
|
|
|
if dec.ParentHash != nil {
|
|
|
|
b.ParentHash = *dec.ParentHash
|
|
|
|
}
|
|
|
|
if dec.ReceiptTrie != nil {
|
|
|
|
b.ReceiptTrie = *dec.ReceiptTrie
|
|
|
|
}
|
|
|
|
if dec.StateRoot != nil {
|
|
|
|
b.StateRoot = *dec.StateRoot
|
|
|
|
}
|
|
|
|
if dec.TransactionsTrie != nil {
|
|
|
|
b.TransactionsTrie = *dec.TransactionsTrie
|
|
|
|
}
|
|
|
|
if dec.UncleHash != nil {
|
|
|
|
b.UncleHash = *dec.UncleHash
|
|
|
|
}
|
|
|
|
if dec.ExtraData != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
b.ExtraData = *dec.ExtraData
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
|
|
|
if dec.Difficulty != nil {
|
|
|
|
b.Difficulty = (*big.Int)(dec.Difficulty)
|
|
|
|
}
|
|
|
|
if dec.GasLimit != nil {
|
2017-11-13 14:47:27 +03:00
|
|
|
b.GasLimit = uint64(*dec.GasLimit)
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
|
|
|
if dec.GasUsed != nil {
|
2017-11-13 14:47:27 +03:00
|
|
|
b.GasUsed = uint64(*dec.GasUsed)
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
|
|
|
if dec.Timestamp != nil {
|
2019-04-02 23:28:48 +03:00
|
|
|
b.Timestamp = uint64(*dec.Timestamp)
|
2017-07-11 14:49:14 +03:00
|
|
|
}
|
2021-07-29 15:05:22 +03:00
|
|
|
if dec.BaseFeePerGas != nil {
|
|
|
|
b.BaseFeePerGas = (*big.Int)(dec.BaseFeePerGas)
|
2021-06-07 15:37:56 +03:00
|
|
|
}
|
2023-02-06 22:52:51 +03:00
|
|
|
if dec.WithdrawalsRoot != nil {
|
|
|
|
b.WithdrawalsRoot = dec.WithdrawalsRoot
|
|
|
|
}
|
2023-08-26 16:42:27 +03:00
|
|
|
if dec.BlobGasUsed != nil {
|
|
|
|
b.BlobGasUsed = (*uint64)(dec.BlobGasUsed)
|
|
|
|
}
|
|
|
|
if dec.ExcessBlobGas != nil {
|
|
|
|
b.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas)
|
|
|
|
}
|
|
|
|
if dec.ParentBeaconBlockRoot != nil {
|
|
|
|
b.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot
|
|
|
|
}
|
2017-07-11 14:49:14 +03:00
|
|
|
return nil
|
|
|
|
}
|