From f2e7f1dd241d18ef8231d170a8d3d3de0b7d9ebe Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 21 Jun 2024 15:00:56 +0800 Subject: [PATCH] fix: ensure empty withdrawals after cancun before broadcast (#2525) --- eth/fetcher/block_fetcher.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eth/fetcher/block_fetcher.go b/eth/fetcher/block_fetcher.go index 0e4f068ce..fa5a32498 100644 --- a/eth/fetcher/block_fetcher.go +++ b/eth/fetcher/block_fetcher.go @@ -731,9 +731,6 @@ func (f *BlockFetcher) loop() { matched = true if f.getBlock(hash) == nil { block := types.NewBlockWithHeader(announce.header).WithBody(task.transactions[i], task.uncles[i]) - if block.Header().EmptyWithdrawalsHash() { - block = block.WithWithdrawals(make([]*types.Withdrawal, 0)) - } block = block.WithSidecars(task.sidecars[i]) block.ReceivedAt = task.time blocks = append(blocks, block) @@ -919,6 +916,10 @@ func (f *BlockFetcher) importBlocks(op *blockOrHeaderInject) { return } + if block.Header().EmptyWithdrawalsHash() { + block = block.WithWithdrawals(make([]*types.Withdrawal, 0)) + } + defer func() { f.done <- hash }() // Quickly validate the header and propagate the block if it passes switch err := f.verifyHeader(block.Header()); err {