Skip to content

Commit

Permalink
fix(downloader): remove optimization for single full block download (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk committed Feb 27, 2024
1 parent 0931fe1 commit 649db66
Showing 1 changed file with 2 additions and 8 deletions.
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

0 comments on commit 649db66

Please sign in to comment.