Trait tc_network_gossip::Validator[][src]

pub trait Validator<B: BlockT>: Send + Sync {
    fn validate(
        &self,
        context: &mut dyn ValidatorContext<B>,
        sender: &PeerId,
        data: &[u8]
    ) -> ValidationResult<B::Hash>; fn new_peer(
        &self,
        _context: &mut dyn ValidatorContext<B>,
        _who: &PeerId,
        _role: ObservedRole
    ) { ... }
fn peer_disconnected(
        &self,
        _context: &mut dyn ValidatorContext<B>,
        _who: &PeerId
    ) { ... }
fn message_expired<'a>(
        &'a self
    ) -> Box<dyn FnMut(B::Hash, &[u8]) -> bool + 'a> { ... }
fn message_allowed<'a>(
        &'a self
    ) -> Box<dyn FnMut(&PeerId, MessageIntent, &B::Hash, &[u8]) -> bool + 'a> { ... } }

Validates consensus messages.

Required methods

fn validate(
    &self,
    context: &mut dyn ValidatorContext<B>,
    sender: &PeerId,
    data: &[u8]
) -> ValidationResult<B::Hash>
[src]

Validate consensus message.

Loading content...

Provided methods

fn new_peer(
    &self,
    _context: &mut dyn ValidatorContext<B>,
    _who: &PeerId,
    _role: ObservedRole
)
[src]

New peer is connected.

fn peer_disconnected(
    &self,
    _context: &mut dyn ValidatorContext<B>,
    _who: &PeerId
)
[src]

New connection is dropped.

fn message_expired<'a>(&'a self) -> Box<dyn FnMut(B::Hash, &[u8]) -> bool + 'a>[src]

Produce a closure for validating messages on a given topic.

fn message_allowed<'a>(
    &'a self
) -> Box<dyn FnMut(&PeerId, MessageIntent, &B::Hash, &[u8]) -> bool + 'a>
[src]

Produce a closure for filtering egress messages.

Loading content...

Implementors

impl<B: BlockT> Validator<B> for DiscardAll[src]

Loading content...