mirror of
https://github.com/serai-dex/serai.git
synced 2025-02-03 11:46:31 +00:00
Fix handling of the GossipEngine
This commit is contained in:
parent
e3fc3f28fb
commit
38cee041d6
3 changed files with 16 additions and 3 deletions
|
@ -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 (
|
||||
authority,
|
||||
sc_service::PartialComponents {
|
||||
|
@ -169,6 +169,16 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
|
|||
},
|
||||
) = 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) =
|
||||
sc_service::build_network(sc_service::BuildNetworkParams {
|
||||
config: &config,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue