From bd6a05e1eea340cead56478f7fc81cade80a3cad Mon Sep 17 00:00:00 2001 From: lightclient <14004106+lightclient@users.noreply.github.com> Date: Tue, 31 Jan 2023 01:34:03 -0700 Subject: [PATCH] internal/ethapi: always return block withdrawals if present (#26565) The execution-apis specification says that the full list of withdrawals should always be returned when requesting a block over RPC: https://github.com/ethereum/execution-apis/blob/378c4304f75b5af2c9b5263c9c76b511e33e8984/src/schemas/block.yaml#L90-L94 This change adopts the expected behavior. --- internal/ethapi/api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 1ac9c5faa..4fa5b9e67 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1246,8 +1246,6 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param } } fields["transactions"] = transactions - // inclTx also expands withdrawals - fields["withdrawals"] = block.Withdrawals() } uncles := block.Uncles() uncleHashes := make([]common.Hash, len(uncles)) @@ -1255,7 +1253,9 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param uncleHashes[i] = uncle.Hash() } fields["uncles"] = uncleHashes - + if block.Header().WithdrawalsHash != nil { + fields["withdrawals"] = block.Withdrawals() + } return fields, nil }