From 38cee041d60da79bb2fea58d9c8c013f376bf4db Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 2 Nov 2022 02:43:08 -0400 Subject: [PATCH] Fix handling of the GossipEngine --- substrate/node/src/service.rs | 12 +++++++++++- substrate/tendermint/client/src/authority/mod.rs | 6 ++++-- substrate/tendermint/client/src/lib.rs | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/substrate/node/src/service.rs b/substrate/node/src/service.rs index 5a122df1..fcf863ff 100644 --- a/substrate/node/src/service.rs +++ b/substrate/node/src/service.rs @@ -154,7 +154,7 @@ pub fn new_partial( )) } -pub async fn new_full(config: Configuration) -> Result { +pub async fn new_full(mut config: Configuration) -> Result { let ( authority, sc_service::PartialComponents { @@ -169,6 +169,16 @@ pub async fn new_full(config: Configuration) -> Result TendermintAuthority { // 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 TendermintAuthority { // 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 diff --git a/substrate/tendermint/client/src/lib.rs b/substrate/tendermint/client/src/lib.rs index 6b12eaab..5a9e1fdd 100644 --- a/substrate/tendermint/client/src/lib.rs +++ b/substrate/tendermint/client/src/lib.rs @@ -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 {