Fix handling of the GossipEngine

This commit is contained in:
Luke Parker
2022-11-02 02:43:08 -04:00
parent e3fc3f28fb
commit 38cee041d6
3 changed files with 16 additions and 3 deletions

View File

@@ -34,7 +34,8 @@ use tendermint_machine::{
};
use crate::{
CONSENSUS_ID, TendermintValidator, validators::TendermintValidators, tendermint::TendermintImport,
CONSENSUS_ID, PROTOCOL_NAME, TendermintValidator, validators::TendermintValidators,
tendermint::TendermintImport,
};
mod gossip;
@@ -150,7 +151,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
// Create the gossip network
let mut gossip = GossipEngine::new(
network.clone(),
"tendermint",
PROTOCOL_NAME,
Arc::new(TendermintGossip::new(number.clone(), self.import.validators.clone())),
registry,
);
@@ -190,6 +191,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
// Handle any received messages
// This inner loop enables handling all pending messages before acquiring the out-queue lock
// again
futures::poll!(&mut gossip);
'inner: loop {
match recv.try_next() {
Ok(Some(msg)) => handle

View File

@@ -30,6 +30,7 @@ pub use authority::TendermintAuthority;
pub const CONSENSUS_ID: [u8; 4] = *b"tend";
pub const KEY_TYPE_ID: KeyTypeId = KeyTypeId(CONSENSUS_ID);
pub const PROTOCOL_NAME: &str = "/serai/tendermint/1";
/// Trait consolidating all generics required by sc_tendermint for processing.
pub trait TendermintClient: Send + Sync + 'static {