Skip to main content

EthResponseValidator

Trait EthResponseValidator 

Source
pub trait EthResponseValidator {
    // Required methods
    fn is_likely_bad_headers_response(&self, request: &HeadersRequest) -> bool;
    fn reputation_change_err(&self) -> Option<ReputationChangeKind>;
}
Available on crate feature network only.
Expand description

Helper trait used to validate responses.

Required Methods§

Source

fn is_likely_bad_headers_response(&self, request: &HeadersRequest) -> bool

Determine whether the response matches what we requested in HeadersRequest

Source

fn reputation_change_err(&self) -> Option<ReputationChangeKind>

Return the response reputation impact if any

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<H> EthResponseValidator for Result<Vec<H>, RequestError>
where H: BlockHeader,

Source§

fn reputation_change_err(&self) -> Option<ReputationChangeKind>

RequestError::ChannelClosed is not possible here since these errors are mapped to ConnectionDropped, which will be handled when the dropped connection is cleaned up.

RequestError::ConnectionDropped should be ignored here because this is already handled when the dropped connection is handled.

RequestError::UnsupportedCapability is also used for locally rejected optional requests, which should not affect peer reputation.

Source§

fn is_likely_bad_headers_response(&self, request: &HeadersRequest) -> bool

Implementors§