|
|
|
@ -33,6 +33,7 @@ func (h Header) MarshalJSON() ([]byte, error) { |
|
|
|
|
Nonce BlockNonce `json:"nonce"` |
|
|
|
|
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` |
|
|
|
|
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"` |
|
|
|
|
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"` |
|
|
|
|
Hash common.Hash `json:"hash"` |
|
|
|
|
} |
|
|
|
|
var enc Header |
|
|
|
@ -53,6 +54,7 @@ func (h Header) MarshalJSON() ([]byte, error) { |
|
|
|
|
enc.Nonce = h.Nonce |
|
|
|
|
enc.BaseFee = (*hexutil.Big)(h.BaseFee) |
|
|
|
|
enc.WithdrawalsHash = h.WithdrawalsHash |
|
|
|
|
enc.ExcessDataGas = h.ExcessDataGas |
|
|
|
|
enc.Hash = h.Hash() |
|
|
|
|
return json.Marshal(&enc) |
|
|
|
|
} |
|
|
|
@ -77,6 +79,7 @@ func (h *Header) UnmarshalJSON(input []byte) error { |
|
|
|
|
Nonce *BlockNonce `json:"nonce"` |
|
|
|
|
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` |
|
|
|
|
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"` |
|
|
|
|
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"` |
|
|
|
|
} |
|
|
|
|
var dec Header |
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil { |
|
|
|
@ -145,5 +148,8 @@ func (h *Header) UnmarshalJSON(input []byte) error { |
|
|
|
|
if dec.WithdrawalsHash != nil { |
|
|
|
|
h.WithdrawalsHash = dec.WithdrawalsHash |
|
|
|
|
} |
|
|
|
|
if dec.ExcessDataGas != nil { |
|
|
|
|
h.ExcessDataGas = dec.ExcessDataGas |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|