Skip to content

Commit

Permalink
fix: remove single body response check (paradigmxyz#3783)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jul 14, 2023
1 parent c0cafc7 commit bc91caf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/net/downloaders/src/bodies/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ where
// Increment total downloaded metric
self.metrics.total_downloaded.increment(response_len as u64);

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

Expand Down

0 comments on commit bc91caf

Please sign in to comment.