Skip to content

Commit 9450dbf

Browse files
beacon/engine: marshall withdrawals even if nil
1 parent 9cc2a54 commit 9450dbf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

beacon/engine/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,5 @@ func BlockToExecutableData(block *types.Block, fees *big.Int) *ExecutionPayloadE
233233
// ExecutionPayloadBodyV1 is used in the response to GetPayloadBodiesByHashV1 and GetPayloadBodiesByRangeV1
234234
type ExecutionPayloadBodyV1 struct {
235235
TransactionData []hexutil.Bytes `json:"transactions"`
236-
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`
236+
Withdrawals []*types.Withdrawal `json:"withdrawals"`
237237
}

eth/catalyst/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBodyV1 {
825825
var (
826826
body = block.Body()
827827
txs = make([]hexutil.Bytes, len(body.Transactions))
828-
withdrawals = make([]*types.Withdrawal, 0)
828+
withdrawals = body.Withdrawals
829829
)
830830

831831
for j, tx := range body.Transactions {
@@ -834,8 +834,8 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBodyV1 {
834834
}
835835

836836
// Post-shanghai withdrawals MUST be set to empty slice instead of nil
837-
if body.Withdrawals != nil {
838-
withdrawals = body.Withdrawals
837+
if withdrawals == nil && block.Header().WithdrawalsHash != nil {
838+
withdrawals = make([]*types.Withdrawal, 0)
839839
}
840840

841841
return &engine.ExecutionPayloadBodyV1{

0 commit comments

Comments
 (0)