mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Fix handling of the GossipEngine
This commit is contained in:
@@ -154,7 +154,7 @@ pub fn new_partial(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
pub async fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||||
let (
|
let (
|
||||||
authority,
|
authority,
|
||||||
sc_service::PartialComponents {
|
sc_service::PartialComponents {
|
||||||
@@ -169,6 +169,16 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
|
|||||||
},
|
},
|
||||||
) = new_partial(&config)?;
|
) = new_partial(&config)?;
|
||||||
|
|
||||||
|
if config.role.is_authority() {
|
||||||
|
// Block size + 1 KiB
|
||||||
|
let mut cfg = sc_service::config::NonDefaultSetConfig::new(
|
||||||
|
sc_tendermint::PROTOCOL_NAME.into(),
|
||||||
|
(1024 * 1024) + 1024,
|
||||||
|
);
|
||||||
|
cfg.allow_non_reserved(25, 25);
|
||||||
|
config.network.extra_sets.push(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
|
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
|
||||||
sc_service::build_network(sc_service::BuildNetworkParams {
|
sc_service::build_network(sc_service::BuildNetworkParams {
|
||||||
config: &config,
|
config: &config,
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ use tendermint_machine::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
CONSENSUS_ID, TendermintValidator, validators::TendermintValidators, tendermint::TendermintImport,
|
CONSENSUS_ID, PROTOCOL_NAME, TendermintValidator, validators::TendermintValidators,
|
||||||
|
tendermint::TendermintImport,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod gossip;
|
mod gossip;
|
||||||
@@ -150,7 +151,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
|||||||
// Create the gossip network
|
// Create the gossip network
|
||||||
let mut gossip = GossipEngine::new(
|
let mut gossip = GossipEngine::new(
|
||||||
network.clone(),
|
network.clone(),
|
||||||
"tendermint",
|
PROTOCOL_NAME,
|
||||||
Arc::new(TendermintGossip::new(number.clone(), self.import.validators.clone())),
|
Arc::new(TendermintGossip::new(number.clone(), self.import.validators.clone())),
|
||||||
registry,
|
registry,
|
||||||
);
|
);
|
||||||
@@ -190,6 +191,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
|||||||
// Handle any received messages
|
// Handle any received messages
|
||||||
// This inner loop enables handling all pending messages before acquiring the out-queue lock
|
// This inner loop enables handling all pending messages before acquiring the out-queue lock
|
||||||
// again
|
// again
|
||||||
|
futures::poll!(&mut gossip);
|
||||||
'inner: loop {
|
'inner: loop {
|
||||||
match recv.try_next() {
|
match recv.try_next() {
|
||||||
Ok(Some(msg)) => handle
|
Ok(Some(msg)) => handle
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ pub use authority::TendermintAuthority;
|
|||||||
|
|
||||||
pub const CONSENSUS_ID: [u8; 4] = *b"tend";
|
pub const CONSENSUS_ID: [u8; 4] = *b"tend";
|
||||||
pub const KEY_TYPE_ID: KeyTypeId = KeyTypeId(CONSENSUS_ID);
|
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.
|
/// Trait consolidating all generics required by sc_tendermint for processing.
|
||||||
pub trait TendermintClient: Send + Sync + 'static {
|
pub trait TendermintClient: Send + Sync + 'static {
|
||||||
|
|||||||
Reference in New Issue
Block a user