diff --git a/substrate/client/network/sync/src/block_request_handler.rs b/substrate/client/network/sync/src/block_request_handler.rs index 78d6a1a7d1..4cd69d1fac 100644 --- a/substrate/client/network/sync/src/block_request_handler.rs +++ b/substrate/client/network/sync/src/block_request_handler.rs @@ -204,15 +204,15 @@ where let mut reputation_change = None; + let small_request = attributes + .difference(BlockAttributes::HEADER | BlockAttributes::JUSTIFICATION) + .is_empty(); + match self.seen_requests.get_mut(&key) { Some(SeenRequestsValue::First) => {}, Some(SeenRequestsValue::Fulfilled(ref mut requests)) => { *requests = requests.saturating_add(1); - let small_request = attributes - .difference(BlockAttributes::HEADER | BlockAttributes::JUSTIFICATION) - .is_empty(); - if *requests > MAX_NUMBER_OF_SAME_REQUESTS_PER_PEER { reputation_change = Some(if small_request { rep::SAME_SMALL_REQUEST @@ -237,7 +237,7 @@ where attributes, ); - let result = if reputation_change.is_none() { + let result = if reputation_change.is_none() || small_request { let block_response = self.get_block_response( attributes, from_block_id,