From 649db667fb9605393d1033ec05b60b5867f61bd6 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Tue, 27 Feb 2024 11:19:15 +0100 Subject: [PATCH] fix(downloader): remove optimization for single full block download (#6820) --- crates/interfaces/src/p2p/full_block.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/interfaces/src/p2p/full_block.rs b/crates/interfaces/src/p2p/full_block.rs index 5471a8f6e1..3ab8e76440 100644 --- a/crates/interfaces/src/p2p/full_block.rs +++ b/crates/interfaces/src/p2p/full_block.rs @@ -81,12 +81,6 @@ where count: u64, ) -> FetchFullBlockRangeFuture { 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, @@ -96,7 +90,7 @@ where limit: count, direction: HeadersDirection::Falling, })), - bodies: bodies_request, + bodies: None, }, client, headers: None, @@ -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 { - self.pending_headers.iter().map(|h| h.hash()).collect::>() + self.pending_headers.iter().map(|h| h.hash()).collect() } /// Returns the [SealedBlock]s if the request is complete and valid.