mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 12:07:57 +00:00
node: setup disabled grandpa properly (#3356)
This commit is contained in:
committed by
Robert Habermeier
parent
98d502466d
commit
59c88cb2f3
@@ -554,6 +554,28 @@ impl<B: BlockT> ConsensusGossip<B> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A gossip message validator that discards all messages.
|
||||
pub struct DiscardAll;
|
||||
|
||||
impl<B: BlockT> Validator<B> for DiscardAll {
|
||||
fn validate(
|
||||
&self,
|
||||
_context: &mut dyn ValidatorContext<B>,
|
||||
_sender: &PeerId,
|
||||
_data: &[u8],
|
||||
) -> ValidationResult<B::Hash> {
|
||||
ValidationResult::Discard
|
||||
}
|
||||
|
||||
fn message_expired<'a>(&'a self) -> Box<dyn FnMut(B::Hash, &[u8]) -> bool + 'a> {
|
||||
Box::new(move |_topic, _data| true)
|
||||
}
|
||||
|
||||
fn message_allowed<'a>(&'a self) -> Box<dyn FnMut(&PeerId, MessageIntent, &B::Hash, &[u8]) -> bool + 'a> {
|
||||
Box::new(move |_who, _intent, _topic, _data| false)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use sr_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper};
|
||||
|
||||
Reference in New Issue
Block a user