diff --git a/crates/consensus/beacon/src/engine/sync.rs b/crates/consensus/beacon/src/engine/sync.rs index 73bb85dbb9..b422583f2d 100644 --- a/crates/consensus/beacon/src/engine/sync.rs +++ b/crates/consensus/beacon/src/engine/sync.rs @@ -13,7 +13,7 @@ use reth_stages::{ControlFlow, Pipeline, PipelineError, PipelineWithResult}; use reth_tasks::TaskSpawner; use std::{ cmp::{Ordering, Reverse}, - collections::BinaryHeap, + collections::{binary_heap::PeekMut, BinaryHeap}, task::{ready, Context, Poll}, }; use tokio::sync::oneshot; @@ -304,6 +304,14 @@ where // drain an element of the block buffer if there are any if let Some(block) = self.range_buffered_blocks.pop() { + // peek ahead and pop duplicates + while let Some(peek) = self.range_buffered_blocks.peek_mut() { + if peek.0 .0.hash() == block.0 .0.hash() { + PeekMut::pop(peek); + } else { + break + } + } return Poll::Ready(EngineSyncEvent::FetchedFullBlock(block.0 .0)) }