Unverified Commit e1b98f49 authored by Peter (bitfly)'s avatar Peter (bitfly) Committed by GitHub

ethclient: include withdrawals in ethclient block responses (#26778)

* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization
parent 2bb622ce
...@@ -105,6 +105,7 @@ type rpcBlock struct { ...@@ -105,6 +105,7 @@ type rpcBlock struct {
Hash common.Hash `json:"hash"` Hash common.Hash `json:"hash"`
Transactions []rpcTransaction `json:"transactions"` Transactions []rpcTransaction `json:"transactions"`
UncleHashes []common.Hash `json:"uncles"` UncleHashes []common.Hash `json:"uncles"`
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`
} }
func (ec *Client) getBlock(ctx context.Context, method string, args ...interface{}) (*types.Block, error) { func (ec *Client) getBlock(ctx context.Context, method string, args ...interface{}) (*types.Block, error) {
...@@ -169,7 +170,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface ...@@ -169,7 +170,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
} }
txs[i] = tx.tx txs[i] = tx.tx
} }
return types.NewBlockWithHeader(head).WithBody(txs, uncles), nil return types.NewBlockWithHeader(head).WithBody(txs, uncles).WithWithdrawals(body.Withdrawals), nil
} }
// HeaderByHash returns the block header with the given hash. // HeaderByHash returns the block header with the given hash.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment