pub(crate) fn outgoing_messages<Block: BlockT, N: Network<Block>>(
	round: u64,
	set_id: u64,
	local_key: Option<Arc<ed25519::Pair>>,
	voters: Arc<VoterSet<AuthorityId>>,
	network: N,
) -> (
	impl Stream<Item=SignedMessage<Block>,Error=Error>,
	OutgoingMessages<Block, N>,
) {
	let locals = local_key.and_then(|pair| {
		let public = pair.public();
		let id = AuthorityId(public.0);
		if voters.contains_key(&id) {
			Some((pair, id))
		} else {
			None
		}
	});

	let (tx, rx) = mpsc::unbounded();
	let outgoing = OutgoingMessages::<Block, N> {
		round,
		set_id,
		network,
		locals,
		sender: tx,
	};

	let rx = rx.map_err(move |()| Error::Network(
		format!("Failed to receive on unbounded receiver for round {}", round)
	));

	(rx, outgoing)
}
/// A sink for outgoing messages. This signs the messages with the key,
/// if we are an authority. A stream for the signed messages is also returned.
///
/// A future can push unsigned messages into the sink. They will be automatically
/// broadcast to the network. The returned stream should be combined with other input.
A sink for outgoing messages. This signs the messages with the key,
if we are an authority. A stream for the signed messages is also returned.

A future can push unsigned messages into the sink. They will be automatically
broadcast to the network. The returned stream should be combined with other input.
A sink for outgoing messages . This signs the messages with the key if we are an authority . A stream for the signed messages is also returned . A future can push unsigned messages into the sink . They will be automatically broadcast to the network . The returned stream should be combined with other input .
pub(crate) fn outgoing_messages<Block: BlockT, N: Network<Block>>(
	round: u64,
	set_id: u64,
	local_key: Option<Arc<ed25519::Pair>>,
	voters: Arc<VoterSet<AuthorityId>>,
	network: N,
) -> (
	impl Stream<Item=SignedMessage<Block>,Error=Error>,
	OutgoingMessages<Block, N>,
) {
	let locals = local_key.and_then(|pair| {
		let public = pair.public();
		let id = AuthorityId(public.0);
		if voters.contains_key(&id) {
			Some((pair, id))
		} else {
			None
		}
	});
	let (tx, rx) = mpsc::unbounded();
	let outgoing = OutgoingMessages::<Block, N> {
		round,
		set_id,
		network,
		locals,
		sender: tx,
	};
	let rx = rx.map_err(move |()| Error::Network(
		format!("Failed to receive on unbounded receiver for round {}", round)
	));
	(rx, outgoing)
}
pub ( crate ) fn outgoing_messages < Block : BlockT , N : Network < Block > > ( round : u64 , set_id : u64 , local_key : Option < Arc < ed25519 :: Pair > > , voters : Arc < VoterSet < AuthorityId > > , network : N , ) -> ( impl Stream < Item = SignedMessage < Block > , Error = Error > , OutgoingMessages < Block , N > , ) { let locals = local_key . and_then ( | pair | { let public = pair . public ( ) ; let id = AuthorityId ( public . 0 ) ; if voters . contains_key ( & id ) { Some ( ( pair , id ) ) } else { None } } ) ; let ( tx , rx ) = mpsc :: unbounded ( ) ; let outgoing = OutgoingMessages :: < Block , N > { round , set_id , network , locals , sender : tx , } ; let rx = rx . map_err ( move | ( ) | Error :: Network ( format ! ( " " round ) ) ) ; ( rx , outgoing ) }
A sink for outgoing messages.
A sink for outgoing messages .
round
u64
set_id
u64
local_key
Option<Arc<ed25519::Pair>>
voters
Arc<VoterSet<AuthorityId>>
network
N
round
u64
set_id
u64
local_key
Option<Arc<ed25519::Pair>>
voters
Arc<VoterSet<AuthorityId>>
network
N