Struct lumina_node::test_utils::MockP2pHandle
source · pub struct MockP2pHandle { /* private fields */ }Available on crate feature
test-utils only.Expand description
A handle to the mocked P2p component.
Implementations§
source§impl MockP2pHandle
impl MockP2pHandle
sourcepub fn announce_peer_connected(&self)
pub fn announce_peer_connected(&self)
Simulate a new connected peer.
sourcepub fn announce_trusted_peer_connected(&self)
pub fn announce_trusted_peer_connected(&self)
Simulate a new connected trusted peer.
sourcepub fn announce_all_peers_disconnected(&self)
pub fn announce_all_peers_disconnected(&self)
Simulate a disconnect from all peers.
sourcepub fn announce_new_head(&self, header: ExtendedHeader)
pub fn announce_new_head(&self, header: ExtendedHeader)
Simulate a new header announced in the network.
sourcepub async fn expect_no_cmd(&mut self)
pub async fn expect_no_cmd(&mut self)
Assert that no command was sent to the P2p worker.
sourcepub async fn expect_header_request_cmd(
&mut self
) -> (HeaderRequest, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
pub async fn expect_header_request_cmd( &mut self ) -> (HeaderRequest, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
Assert that a header request was sent to the P2p worker and obtain a response channel.
sourcepub async fn expect_header_request_for_height_cmd(
&mut self
) -> (u64, u64, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
pub async fn expect_header_request_for_height_cmd( &mut self ) -> (u64, u64, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
Assert that a header request for height was sent to the P2p worker and obtain a response channel.
sourcepub async fn expect_header_request_for_hash_cmd(
&mut self
) -> (Hash, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
pub async fn expect_header_request_for_hash_cmd( &mut self ) -> (Hash, Sender<Result<Vec<ExtendedHeader>, P2pError>>)
Assert that a header request for hash was sent to the P2p worker and obtain a response channel.
sourcepub async fn expect_init_header_sub(&mut self) -> ExtendedHeader
pub async fn expect_init_header_sub(&mut self) -> ExtendedHeader
Assert that a header-sub initialization command was sent to the P2p worker.
Auto Trait Implementations§
impl !RefUnwindSafe for MockP2pHandle
impl Send for MockP2pHandle
impl Sync for MockP2pHandle
impl Unpin for MockP2pHandle
impl !UnwindSafe for MockP2pHandle
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more