Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions finality-aleph/src/network/io.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
use std::fmt::Debug;

use futures::channel::mpsc;

use crate::{
network::{
manager::{DataInSession, VersionedAuthentication},
ConnectionManagerIO, Data, Multiaddress, NetworkServiceIO as NetworkIO, SessionManagerIO,
AddressingInformation, ConnectionManagerIO, Data, NetworkServiceIO as NetworkIO,
SessionManagerIO,
},
validator_network::{Network as ValidatorNetwork, PublicKey},
};

type AuthenticationNetworkIO<M> = NetworkIO<VersionedAuthentication<M>>;
type AuthenticationNetworkIO<M, A> = NetworkIO<VersionedAuthentication<M, A>>;

type FullIO<D, M, A, VN> = (
ConnectionManagerIO<D, M, A, VN>,
AuthenticationNetworkIO<M, A>,
SessionManagerIO<D>,
);

pub fn setup<
D: Data,
M: Multiaddress + 'static,
VN: ValidatorNetwork<M::PeerId, M, DataInSession<D>>,
M: Data + Debug,
A: AddressingInformation + TryFrom<Vec<M>> + Into<Vec<M>>,
VN: ValidatorNetwork<A::PeerId, A, DataInSession<D>>,
>(
validator_network: VN,
) -> (
ConnectionManagerIO<D, M, VN>,
AuthenticationNetworkIO<M>,
SessionManagerIO<D>,
)
) -> FullIO<D, M, A, VN>
where
M::PeerId: PublicKey,
A::PeerId: PublicKey,
{
// Prepare and start the network
let (messages_for_network, messages_from_user) = mpsc::unbounded();
Expand Down
Loading