mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 20:59:23 +00:00
Move the node over to the new SelectChain
This commit is contained in:
@@ -2,13 +2,14 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||||
use sc_executor::NativeElseWasmExecutor;
|
use sc_executor::NativeElseWasmExecutor;
|
||||||
|
use sc_client_api::Backend;
|
||||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||||
|
|
||||||
use serai_runtime::{self, opaque::Block, RuntimeApi};
|
use serai_runtime::{self, opaque::Block, RuntimeApi};
|
||||||
pub(crate) use serai_consensus::{ExecutorDispatch, FullClient};
|
pub(crate) use serai_consensus::{ExecutorDispatch, FullClient};
|
||||||
|
|
||||||
type FullBackend = sc_service::TFullBackend<Block>;
|
type FullBackend = sc_service::TFullBackend<Block>;
|
||||||
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
|
type FullSelectChain = serai_consensus::TendermintSelectChain<Block, FullBackend>;
|
||||||
|
|
||||||
type PartialComponents = sc_service::PartialComponents<
|
type PartialComponents = sc_service::PartialComponents<
|
||||||
FullClient,
|
FullClient,
|
||||||
@@ -55,8 +56,6 @@ pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceE
|
|||||||
telemetry
|
telemetry
|
||||||
});
|
});
|
||||||
|
|
||||||
let select_chain = sc_consensus::LongestChain::new(backend.clone());
|
|
||||||
|
|
||||||
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
||||||
config.transaction_pool.clone(),
|
config.transaction_pool.clone(),
|
||||||
config.role.is_authority().into(),
|
config.role.is_authority().into(),
|
||||||
@@ -65,12 +64,10 @@ pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceE
|
|||||||
client.clone(),
|
client.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let import_queue = serai_consensus::import_queue(
|
let import_queue =
|
||||||
&task_manager,
|
serai_consensus::import_queue(&task_manager, client.clone(), config.prometheus_registry())?;
|
||||||
client.clone(),
|
|
||||||
select_chain.clone(),
|
let select_chain = serai_consensus::TendermintSelectChain::new(backend.clone());
|
||||||
config.prometheus_registry(),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
Ok(sc_service::PartialComponents {
|
Ok(sc_service::PartialComponents {
|
||||||
client,
|
client,
|
||||||
@@ -153,7 +150,6 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
|||||||
client,
|
client,
|
||||||
network,
|
network,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
select_chain,
|
|
||||||
prometheus_registry.as_ref(),
|
prometheus_registry.as_ref(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user