mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Return a successful response on repeated small block request (#11429)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user