sc_network_gossip

Trait ValidatorContext

source
pub trait ValidatorContext<B: BlockT> {
    // Required methods
    fn broadcast_topic(&mut self, topic: B::Hash, force: bool);
    fn broadcast_message(
        &mut self,
        topic: B::Hash,
        message: Vec<u8>,
        force: bool,
    );
    fn send_message(&mut self, who: &PeerId, message: Vec<u8>);
    fn send_topic(&mut self, who: &PeerId, topic: B::Hash, force: bool);
}
Expand description

Validation context. Allows reacting to incoming messages by sending out further messages.

Required Methods§

source

fn broadcast_topic(&mut self, topic: B::Hash, force: bool)

Broadcast all messages with given topic to peers that do not have it yet.

source

fn broadcast_message(&mut self, topic: B::Hash, message: Vec<u8>, force: bool)

Broadcast a message to all peers that have not received it previously.

source

fn send_message(&mut self, who: &PeerId, message: Vec<u8>)

Send addressed message to a peer.

source

fn send_topic(&mut self, who: &PeerId, topic: B::Hash, force: bool)

Send all messages with given topic to a peer.

Implementors§