eth/catalyst: fix withdrawals return

This commit is contained in:
Felix Lange 2024-09-12 20:43:58 +02:00
parent c1c8a2c46d
commit 54ac02bf54

View file

@ -1256,19 +1256,17 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBody {
return nil return nil
} }
var ( var result engine.ExecutionPayloadBody
body = block.Body()
result engine.ExecutionPayloadBody
)
result.TransactionData = make([]hexutil.Bytes, len(body.Transactions)) result.TransactionData = make([]hexutil.Bytes, len(block.Transactions()))
for j, tx := range body.Transactions { for j, tx := range block.Transactions() {
result.TransactionData[j], _ = tx.MarshalBinary() result.TransactionData[j], _ = tx.MarshalBinary()
} }
// Post-shanghai withdrawals MUST be set to empty slice instead of nil // Post-shanghai withdrawals MUST be set to empty slice instead of nil
if body.Withdrawals != nil && block.Header().WithdrawalsHash != nil { result.Withdrawals = block.Withdrawals()
result.Withdrawals = make([]*types.Withdrawal, 0) if block.Withdrawals() == nil && block.Header().WithdrawalsHash != nil {
result.Withdrawals = []*types.Withdrawal{}
} }
if reqs := block.Requests(); reqs != nil { if reqs := block.Requests(); reqs != nil {