Skip to content

Commit

Permalink
Reverting the limiting of req missing blocks to the current batch.
Browse files Browse the repository at this point in the history
  • Loading branch information
ii-cruz committed Nov 12, 2024
1 parent 2153ecd commit d7731e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,6 @@ impl<N: Network> BlockRequestComponent<N> {
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);
}
Expand Down
19 changes: 2 additions & 17 deletions consensus/src/sync/live/block_queue/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,24 +216,9 @@ impl<N: Network> BlockQueue<N> {
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
Expand Down

0 comments on commit d7731e7

Please sign in to comment.