Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit d45e383

Browse files
authored
Return a successful response on repeated small block request (#11429)
1 parent c00ed05 commit d45e383

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

client/network/sync/src/block_request_handler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ where
204204

205205
let mut reputation_change = None;
206206

207+
let small_request = attributes
208+
.difference(BlockAttributes::HEADER | BlockAttributes::JUSTIFICATION)
209+
.is_empty();
210+
207211
match self.seen_requests.get_mut(&key) {
208212
Some(SeenRequestsValue::First) => {},
209213
Some(SeenRequestsValue::Fulfilled(ref mut requests)) => {
210214
*requests = requests.saturating_add(1);
211215

212-
let small_request = attributes
213-
.difference(BlockAttributes::HEADER | BlockAttributes::JUSTIFICATION)
214-
.is_empty();
215-
216216
if *requests > MAX_NUMBER_OF_SAME_REQUESTS_PER_PEER {
217217
reputation_change = Some(if small_request {
218218
rep::SAME_SMALL_REQUEST
@@ -237,7 +237,7 @@ where
237237
attributes,
238238
);
239239

240-
let result = if reputation_change.is_none() {
240+
let result = if reputation_change.is_none() || small_request {
241241
let block_response = self.get_block_response(
242242
attributes,
243243
from_block_id,

0 commit comments

Comments
 (0)