mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-26 05:27:22 +00:00
Inform peers of requests that exceed the maximum rate limit + log downgrade (#1830)
## Issue Addressed #1825 ## Proposed Changes Since we penalize more blocks by range requests that have large steps, it is possible to get requests that will never be processed. We were not informing peers about this requests and also logging CRIT that is no longer relevant. Later we should check if more sophisticated handling for those requests is needed
This commit is contained in:
parent
92c8eba8ca
commit
ad846ad280
@ -233,9 +233,23 @@ where
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
Err(RateLimitedErr::TooLarge) => {
|
Err(RateLimitedErr::TooLarge) => {
|
||||||
// we set the batch sizes, so this is a coding/config err
|
// we set the batch sizes, so this is a coding/config err for most protocols
|
||||||
crit!(self.log, "Batch too large to ever be processed";
|
let protocol = req.protocol();
|
||||||
"protocol" => format!("{}", req.protocol()));
|
if matches!(protocol, Protocol::BlocksByRange) {
|
||||||
|
debug!(self.log, "Blocks by range request will never be processed"; "request" => %req);
|
||||||
|
} else {
|
||||||
|
crit!(self.log, "Request size too large to ever be processed"; "protocol" => %protocol);
|
||||||
|
}
|
||||||
|
// send an error code to the peer.
|
||||||
|
// the handler upon receiving the error code will send it back to the behaviour
|
||||||
|
self.send_response(
|
||||||
|
peer_id,
|
||||||
|
(conn_id, *id),
|
||||||
|
RPCCodedResponse::Error(
|
||||||
|
RPCResponseErrorCode::RateLimited,
|
||||||
|
"Rate limited. Request too large".into(),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Err(RateLimitedErr::TooSoon(wait_time)) => {
|
Err(RateLimitedErr::TooSoon(wait_time)) => {
|
||||||
debug!(self.log, "Request exceeds the rate limit";
|
debug!(self.log, "Request exceeds the rate limit";
|
||||||
|
Loading…
Reference in New Issue
Block a user