From 6d443ca1d2ed917bcb7bf52e15f6e6b6c16be2b1 Mon Sep 17 00:00:00 2001 From: Rez Date: Thu, 20 Mar 2025 07:10:47 +1100 Subject: [PATCH] fix withdrawal nil pointer dereference --- internal/ethapi/simulate.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index c745a0294b..2d8a078c87 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -319,8 +319,13 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, reqHash := types.CalcRequestsHash(requests) header.RequestsHash = &reqHash } - - blockBody := &types.Body{Transactions: txes, Withdrawals: *block.BlockOverrides.Withdrawals} + var withdrawals []*types.Withdrawal + if block.BlockOverrides.Withdrawals != nil { + withdrawals = *block.BlockOverrides.Withdrawals + } else { + withdrawals = []*types.Withdrawal{} + } + blockBody := &types.Body{Transactions: txes, Withdrawals: withdrawals} chainHeadReader := &simChainHeadReader{ctx, sim.b} b, err := sim.b.Engine().FinalizeAndAssemble(chainHeadReader, header, sim.state, blockBody, receipts) if err != nil {