Skip to content

Commit

Permalink
eth.NewHeadsResult: Add EIP-4895 WithdrawalsRoot (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanschneider authored Feb 21, 2023
1 parent 04d006b commit 96eff6c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions eth/new_heads.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type NewHeadsResult struct {
// EIP-1559 BaseFeePerGas
BaseFeePerGas *Quantity `json:"baseFeePerGas,omitempty"`

// EIP-4895 Withdrawals
WithdrawalsRoot *Data32 `json:"withdrawalsRoot,omitempty"`

// Ethhash POW Fields
Nonce *Data8 `json:"nonce"`
MixHash *Data `json:"mixHash"`
Expand Down Expand Up @@ -83,6 +86,9 @@ func (nh *NewHeadsResult) FromBlock(block *Block) {
// EIP-1559 BaseFeePerGas
BaseFeePerGas: block.BaseFeePerGas,

// EIP-4895 Withdrawals
WithdrawalsRoot: block.WithdrawalsRoot,

flavor: block.flavor,
}

Expand Down Expand Up @@ -150,6 +156,9 @@ func (nh NewHeadsResult) MarshalJSON() ([]byte, error) {
// EIP-1559 BaseFeePerGas
BaseFeePerGas *Quantity `json:"baseFeePerGas,omitempty"`

// EIP-4895 Withdrawals
WithdrawalsRoot *Data32 `json:"withdrawalsRoot,omitempty"`

Nonce *Data8 `json:"nonce"`
MixHash *Data `json:"mixHash"`
}
Expand All @@ -171,9 +180,10 @@ func (nh NewHeadsResult) MarshalJSON() ([]byte, error) {
GasUsed: nh.GasUsed,
Timestamp: nh.Timestamp,
// Transactions: nh.Transactions,
BaseFeePerGas: nh.BaseFeePerGas,
Nonce: nh.Nonce,
MixHash: nh.MixHash,
BaseFeePerGas: nh.BaseFeePerGas,
WithdrawalsRoot: nh.WithdrawalsRoot,
Nonce: nh.Nonce,
MixHash: nh.MixHash,
}

return json.Marshal(&g)
Expand Down

0 comments on commit 96eff6c

Please sign in to comment.