pub struct TestFullBlockClient { /* private fields */ }test-utils only.Expand description
A headers+bodies client that stores the headers and bodies in memory, with an artificial soft bodies response limit that is set to 20 by default.
This full block client can be Cloned and shared between multiple tasks.
Implementations§
Source§impl TestFullBlockClient
impl TestFullBlockClient
Sourcepub fn insert(&self, header: SealedHeader, body: BlockBody)
pub fn insert(&self, header: SealedHeader, body: BlockBody)
Insert a header and body into the client maps.
Sourcepub fn insert_access_list(&self, hash: B256, access_list: Bytes)
pub fn insert_access_list(&self, hash: B256, access_list: Bytes)
Insert a raw block access list served for the given block hash.
Sourcepub const fn set_soft_limit(&mut self, limit: usize)
pub const fn set_soft_limit(&mut self, limit: usize)
Set the soft response limit.
Sourcepub fn highest_block(&self) -> Option<SealedBlock<Block>>
pub fn highest_block(&self) -> Option<SealedBlock<Block>>
Get the block with the highest block number.
Trait Implementations§
Source§impl BlockAccessListsClient for TestFullBlockClient
impl BlockAccessListsClient for TestFullBlockClient
Source§type Output = Ready<Result<WithPeerId<BlockAccessLists>, RequestError>>
type Output = Ready<Result<WithPeerId<BlockAccessLists>, RequestError>>
Source§fn get_block_access_lists_with_priority_and_requirement(
&self,
hashes: Vec<B256>,
_priority: Priority,
_requirement: BalRequirement,
) -> Self::Output
fn get_block_access_lists_with_priority_and_requirement( &self, hashes: Vec<B256>, _priority: Priority, _requirement: BalRequirement, ) -> Self::Output
Source§fn get_block_access_lists(&self, hashes: Vec<B256>) -> Self::Output
fn get_block_access_lists(&self, hashes: Vec<B256>) -> Self::Output
Source§fn get_block_access_lists_with_requirement(
&self,
hashes: Vec<B256>,
requirement: BalRequirement,
) -> Self::Output
fn get_block_access_lists_with_requirement( &self, hashes: Vec<B256>, requirement: BalRequirement, ) -> Self::Output
Source§impl BlockClient for TestFullBlockClient
impl BlockClient for TestFullBlockClient
Source§impl BodiesClient for TestFullBlockClient
Implements the BodiesClient trait for the TestFullBlockClient struct.
impl BodiesClient for TestFullBlockClient
Implements the BodiesClient trait for the TestFullBlockClient struct.
Source§type Output = Ready<Result<WithPeerId<Vec<BlockBody<EthereumTxEnvelope<TxEip4844>>>>, RequestError>>
type Output = Ready<Result<WithPeerId<Vec<BlockBody<EthereumTxEnvelope<TxEip4844>>>>, RequestError>>
Defines the output type of the function.
Source§fn get_block_bodies_with_priority_and_range_hint(
&self,
hashes: Vec<B256>,
_priority: Priority,
_range_hint: Option<RangeInclusive<u64>>,
) -> Self::Output
fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<B256>, _priority: Priority, _range_hint: Option<RangeInclusive<u64>>, ) -> Self::Output
Retrieves block bodies corresponding to provided hashes with a given priority.
§Arguments
hashes- A vector of block hashes to retrieve bodies for._priority- Priority level for block body retrieval (unused in this implementation).
§Returns
A future containing the result of the block body retrieval operation.
Source§fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output
fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output
Source§fn get_block_bodies_with_priority(
&self,
hashes: Vec<B256>,
priority: Priority,
) -> Self::Output
fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output
Source§fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output> ⓘ
fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output> ⓘ
Source§fn get_block_body_with_priority(
&self,
hash: B256,
priority: Priority,
) -> SingleBodyRequest<Self::Output> ⓘ
fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output> ⓘ
Source§impl Clone for TestFullBlockClient
impl Clone for TestFullBlockClient
Source§impl Debug for TestFullBlockClient
impl Debug for TestFullBlockClient
Source§impl Default for TestFullBlockClient
impl Default for TestFullBlockClient
Source§impl DownloadClient for TestFullBlockClient
impl DownloadClient for TestFullBlockClient
Source§fn report_bad_message(&self, _peer_id: PeerId)
fn report_bad_message(&self, _peer_id: PeerId)
Reports a bad message from a specific peer.
Source§fn num_connected_peers(&self) -> usize
fn num_connected_peers(&self) -> usize
Retrieves the number of connected peers.
Returns the number of connected peers in the test scenario (1).
Source§impl HeadersClient for TestFullBlockClient
Implements the HeadersClient trait for the TestFullBlockClient struct.
impl HeadersClient for TestFullBlockClient
Implements the HeadersClient trait for the TestFullBlockClient struct.
Source§type Output = Ready<Result<WithPeerId<Vec<Header>>, RequestError>>
type Output = Ready<Result<WithPeerId<Vec<Header>>, RequestError>>
Specifies the associated output type.
Source§fn get_headers_with_priority(
&self,
request: HeadersRequest,
_priority: Priority,
) -> Self::Output
fn get_headers_with_priority( &self, request: HeadersRequest, _priority: Priority, ) -> Self::Output
Source§fn get_headers(&self, request: HeadersRequest) -> Self::Output
fn get_headers(&self, request: HeadersRequest) -> Self::Output
Source§fn get_header(
&self,
start: BlockHashOrNumber,
) -> SingleHeaderRequest<Self::Output> ⓘ
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
Source§fn get_header_with_priority(
&self,
start: BlockHashOrNumber,
priority: Priority,
) -> SingleHeaderRequest<Self::Output> ⓘ
fn get_header_with_priority( &self, start: BlockHashOrNumber, priority: Priority, ) -> SingleHeaderRequest<Self::Output> ⓘ
Auto Trait Implementations§
impl !RefUnwindSafe for TestFullBlockClient
impl !UnwindSafe for TestFullBlockClient
impl Freeze for TestFullBlockClient
impl Send for TestFullBlockClient
impl Sync for TestFullBlockClient
impl Unpin for TestFullBlockClient
impl UnsafeUnpin for TestFullBlockClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> EthBlockClient for Twhere
T: BlockClient<Block = Block<EthereumTxEnvelope<TxEip4844>>>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeDebug for Twhere
T: Debug,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes