Skip to content

Commit

Permalink
internal/ethapi: always return block withdrawals if present (ethereum…
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
lightclient authored and shekhirin committed Jun 6, 2023
1 parent 4de9ae3 commit d6ca922
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,16 +1246,16 @@ 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))
for i, uncle := range uncles {
uncleHashes[i] = uncle.Hash()
}
fields["uncles"] = uncleHashes

if block.Header().WithdrawalsHash != nil {
fields["withdrawals"] = block.Withdrawals()
}
return fields, nil
}

Expand Down

0 comments on commit d6ca922

Please sign in to comment.