mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Allow 1 count block request to return 0 blocks (#5554)
* Allow 1 count block request to return 0 blocks * Address @pawanjay176 review
This commit is contained in:
@@ -91,8 +91,8 @@ impl<E: EthSpec> OutboundRequest<E> {
|
||||
}
|
||||
/* These functions are used in the handler for stream management */
|
||||
|
||||
/// Number of responses expected for this request.
|
||||
pub fn expected_responses(&self) -> u64 {
|
||||
/// Maximum number of responses expected for this request.
|
||||
pub fn max_responses(&self) -> u64 {
|
||||
match self {
|
||||
OutboundRequest::Status(_) => 1,
|
||||
OutboundRequest::Goodbye(_) => 0,
|
||||
@@ -105,6 +105,19 @@ impl<E: EthSpec> OutboundRequest<E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn expect_exactly_one_response(&self) -> bool {
|
||||
match self {
|
||||
OutboundRequest::Status(_) => true,
|
||||
OutboundRequest::Goodbye(_) => false,
|
||||
OutboundRequest::BlocksByRange(_) => false,
|
||||
OutboundRequest::BlocksByRoot(_) => false,
|
||||
OutboundRequest::BlobsByRange(_) => false,
|
||||
OutboundRequest::BlobsByRoot(_) => false,
|
||||
OutboundRequest::Ping(_) => true,
|
||||
OutboundRequest::MetaData(_) => true,
|
||||
}
|
||||
}
|
||||
|
||||
/// Gives the corresponding `SupportedProtocol` to this request.
|
||||
pub fn versioned_protocol(&self) -> SupportedProtocol {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user