From d7731e77d27171f8c7409f758442d301a9a50252 Mon Sep 17 00:00:00 2001 From: ii-cruz Date: Tue, 12 Nov 2024 17:35:09 -0600 Subject: [PATCH] Reverting the limiting of req missing blocks to the current batch. --- .../block_queue/block_request_component.rs | 4 ---- consensus/src/sync/live/block_queue/queue.rs | 19 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/consensus/src/sync/live/block_queue/block_request_component.rs b/consensus/src/sync/live/block_queue/block_request_component.rs index 27b03b1469..70d5b4135e 100644 --- a/consensus/src/sync/live/block_queue/block_request_component.rs +++ b/consensus/src/sync/live/block_queue/block_request_component.rs @@ -318,10 +318,6 @@ impl BlockRequestComponent { self.pending_requests.contains(target_block_hash) } - pub fn has_pending_requests(&self) -> bool { - !self.pending_requests.is_empty() - } - pub fn add_peer(&self, peer_id: N::PeerId) { self.peers.write().add_peer(peer_id); } diff --git a/consensus/src/sync/live/block_queue/queue.rs b/consensus/src/sync/live/block_queue/queue.rs index 9e967eba9b..bec0b66f9c 100644 --- a/consensus/src/sync/live/block_queue/queue.rs +++ b/consensus/src/sync/live/block_queue/queue.rs @@ -216,24 +216,9 @@ impl BlockQueue { macro_height ); block_source.ignore_block(&self.network); - } else if !self.request_component.has_pending_requests() - || macro_height == Policy::last_macro_block(block_number) - { - // We only allow a new request missing blocks to start if the block is from the - // current batch or if there are no ongoing request. - self.buffer_and_request_missing_blocks(block, block_source); } else { - // If we are on not within the same batch or we already are requesting blocks, - // we just buffer it without requesting for blocks. - // Any potential gaps will be filled after we sync up to the batch. - if self.insert_block_into_buffer(block, block_source) { - log::trace!(block_number, "Buffering block"); - } else { - log::trace!( - block_number, - "Not buffering block - already known or exceeded the per peer limit", - ); - } + // Block is inside the buffer window, put it in the buffer. + self.buffer_and_request_missing_blocks(block, block_source); } None