pub struct ChannelNetwork {
pub self_id: ValidatorId,
pub senders: Vec<(ValidatorId, MsgSender)>,
}Expand description
Channel-based network stub: routes messages via mpsc senders
Fields§
§self_id: ValidatorId§senders: Vec<(ValidatorId, MsgSender)>Implementations§
Source§impl ChannelNetwork
impl ChannelNetwork
pub fn new(self_id: ValidatorId, senders: Vec<(ValidatorId, MsgSender)>) -> Self
Sourcepub fn create_mesh(n: u64) -> Vec<(ChannelNetwork, MsgReceiver)>
pub fn create_mesh(n: u64) -> Vec<(ChannelNetwork, MsgReceiver)>
Create a fully-connected mesh of n channel networks.
Returns one (ChannelNetwork, Receiver) pair per validator
(indexed by ValidatorId(0) .. ValidatorId(n-1)),
eliminating the manual HashMap plumbing.
Trait Implementations§
Source§impl NetworkSink for ChannelNetwork
impl NetworkSink for ChannelNetwork
fn broadcast(&self, msg: ConsensusMessage)
fn send_to(&self, target: ValidatorId, msg: ConsensusMessage)
Source§fn on_epoch_change(
&self,
_epoch: EpochNumber,
_new_validator_set: &ValidatorSet,
)
fn on_epoch_change( &self, _epoch: EpochNumber, _new_validator_set: &ValidatorSet, )
Notify the network layer of a validator set change (epoch transition).
Default is no-op for test stubs.
Source§fn broadcast_evidence(&self, _proof: &EquivocationProof)
fn broadcast_evidence(&self, _proof: &EquivocationProof)
Broadcast equivocation evidence to all peers.
Default is no-op for test stubs.
Auto Trait Implementations§
impl Freeze for ChannelNetwork
impl RefUnwindSafe for ChannelNetwork
impl Send for ChannelNetwork
impl Sync for ChannelNetwork
impl Unpin for ChannelNetwork
impl UnsafeUnpin for ChannelNetwork
impl UnwindSafe for ChannelNetwork
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
Mutably borrows from an owned value. Read more