Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(downloader): remove optimization for single full block download #6820

Merged
merged 1 commit into from Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions crates/interfaces/src/p2p/full_block.rs
Expand Up @@ -81,12 +81,6 @@ where
count: u64,
) -> FetchFullBlockRangeFuture<Client> {
let client = self.client.clone();

// Optimization: if we only want one block, we don't need to wait for the headers request
// to complete, and can send the block bodies request right away.
let bodies_request =
if count == 1 { None } else { Some(client.get_block_bodies(vec![hash])) };

FetchFullBlockRangeFuture {
start_hash: hash,
count,
Expand All @@ -96,7 +90,7 @@ where
limit: count,
direction: HeadersDirection::Falling,
})),
bodies: bodies_request,
bodies: None,
},
client,
headers: None,
Expand Down Expand Up @@ -410,7 +404,7 @@ where
/// Returns the remaining hashes for the bodies request, based on the headers that still exist
/// in the `root_map`.
fn remaining_bodies_hashes(&self) -> Vec<B256> {
self.pending_headers.iter().map(|h| h.hash()).collect::<Vec<_>>()
self.pending_headers.iter().map(|h| h.hash()).collect()
}

/// Returns the [SealedBlock]s if the request is complete and valid.
Expand Down