Trait sc_network_test::TestNetFactory[][src]

pub trait TestNetFactory: Sized where
    <Self::BlockImport as BlockImport<Block>>::Transaction: Send
{ type Verifier: 'static + Verifier<Block>; type BlockImport: BlockImport<Block, Error = ConsensusError> + Clone + Send + Sync + 'static; type PeerData: Default;
Show methods fn from_config(config: &ProtocolConfig) -> Self;
fn make_verifier(
        &self,
        client: PeersClient,
        config: &ProtocolConfig,
        peer_data: &Self::PeerData
    ) -> Self::Verifier;
fn peer(&mut self, i: usize) -> &mut Peer<Self::PeerData, Self::BlockImport>;
fn peers(&self) -> &Vec<Peer<Self::PeerData, Self::BlockImport>>;
fn mut_peers<F: FnOnce(&mut Vec<Peer<Self::PeerData, Self::BlockImport>>)>(
        &mut self,
        closure: F
    );
fn make_block_import(
        &self,
        client: PeersClient
    ) -> (BlockImportAdapter<Self::BlockImport>, Option<BoxJustificationImport<Block>>, Self::PeerData); fn default_config() -> ProtocolConfig { ... }
fn new(n: usize) -> Self { ... }
fn add_full_peer(&mut self) { ... }
fn add_full_peer_with_config(&mut self, config: FullPeerConfig) { ... }
fn add_light_peer(&mut self) { ... }
fn spawn_task(&self, f: BoxFuture<'static, ()>) { ... }
fn poll_until_sync(&mut self, cx: &mut FutureContext<'_>) -> Poll<()> { ... }
fn poll_until_idle(&mut self, cx: &mut FutureContext<'_>) -> Poll<()> { ... }
fn poll_until_connected(&mut self, cx: &mut FutureContext<'_>) -> Poll<()> { ... }
fn block_until_sync(&mut self) { ... }
fn block_until_idle(&mut self) { ... }
fn block_until_connected(&mut self) { ... }
fn poll(&mut self, cx: &mut FutureContext<'_>) { ... }
}

Associated Types

Required methods

These two need to be implemented!

Get reference to peer.

Get custom block import handle for fresh client, along with peer data.

Provided methods

Create new test network with this many peers.

Add a full peer.

Add a light peer.

Used to spawn background tasks, e.g. the block request protocol handler.

Polls the testnet until all nodes are in sync.

Must be executed in a task context.

Polls the testnet until theres’ no activiy of any kind.

Must be executed in a task context.

Polls the testnet until all peers are connected to each other.

Must be executed in a task context.

Blocks the current thread until we are sync’ed.

Calls poll_until_sync repeatedly.

Blocks the current thread until there are no pending packets.

Calls poll_until_idle repeatedly with the runtime passed as parameter.

Blocks the current thread until all peers are connected to each other.

Calls poll_until_connected repeatedly with the runtime passed as parameter.

Polls the testnet. Processes all the pending actions.

Implementors