fix: remove single body response check (#3783)

This commit is contained in:
Matthias Seitz
2023-07-14 20:38:09 +02:00
committed by GitHub
parent c0cafc7a4f
commit bc91cafabf

View File

@ -119,11 +119,11 @@ where
// Increment total downloaded metric // Increment total downloaded metric
self.metrics.total_downloaded.increment(response_len as u64); self.metrics.total_downloaded.increment(response_len as u64);
// Malicious peers often return a single block. Mark responses with single // TODO: Malicious peers often return a single block even if it does not exceed the soft
// block when more than 1 were requested invalid. // response limit (2MB). this could be penalized by checking if this block and the
// TODO: Instead of marking single block responses invalid, calculate // next one exceed the soft response limit, if not then peer either does not have the next
// soft response size lower limit and use that for filtering. // block or deliberately sent a single block.
if bodies.is_empty() || (request_len != 1 && response_len == 1) { if bodies.is_empty() {
return Err(DownloadError::EmptyResponse) return Err(DownloadError::EmptyResponse)
} }