From 54ac02bf54c93d3f24733c0b672c86a125097be8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 12 Sep 2024 20:43:58 +0200 Subject: [PATCH] eth/catalyst: fix withdrawals return --- eth/catalyst/api.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index ebe51b6450..19df408b29 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -1256,19 +1256,17 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBody { return nil } - var ( - body = block.Body() - result engine.ExecutionPayloadBody - ) + var result engine.ExecutionPayloadBody - result.TransactionData = make([]hexutil.Bytes, len(body.Transactions)) - for j, tx := range body.Transactions { + result.TransactionData = make([]hexutil.Bytes, len(block.Transactions())) + for j, tx := range block.Transactions() { result.TransactionData[j], _ = tx.MarshalBinary() } // Post-shanghai withdrawals MUST be set to empty slice instead of nil - if body.Withdrawals != nil && block.Header().WithdrawalsHash != nil { - result.Withdrawals = make([]*types.Withdrawal, 0) + result.Withdrawals = block.Withdrawals() + if block.Withdrawals() == nil && block.Header().WithdrawalsHash != nil { + result.Withdrawals = []*types.Withdrawal{} } if reqs := block.Requests(); reqs != nil {