Remove the Future triggering the machine for an async fn

Enables passing data in, such as the network.
This commit is contained in:
Luke Parker
2022-10-30 04:08:33 -04:00
parent 6838d5c922
commit edb2e00db7
7 changed files with 82 additions and 78 deletions

View File

@@ -1,7 +1,4 @@
use std::{
sync::{Arc, RwLock},
future::Future,
};
use std::sync::{Arc, RwLock};
use sp_core::H256;
@@ -11,7 +8,9 @@ use sc_network::{NetworkService, NetworkBlock};
use sc_telemetry::{Telemetry, TelemetryWorker};
use serai_runtime::{self, opaque::Block, RuntimeApi};
pub(crate) use serai_consensus::{ExecutorDispatch, Announce, FullClient};
pub(crate) use serai_consensus::{
TendermintAuthority, ExecutorDispatch, Announce, FullClient, TendermintValidatorFirm,
};
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = serai_consensus::TendermintSelectChain<Block, FullBackend>;
@@ -42,7 +41,13 @@ impl Announce<Block> for NetworkAnnounce {
pub fn new_partial(
config: &Configuration,
) -> Result<((NetworkAnnounce, impl Future<Output = ()>), PartialComponents), ServiceError> {
) -> Result<
(
(NetworkAnnounce, TendermintAuthority<TendermintValidatorFirm<NetworkAnnounce>>),
PartialComponents,
),
ServiceError,
> {
if config.keystore_remote.is_some() {
return Err(ServiceError::Other("Remote Keystores are not supported".to_string()));
}
@@ -179,7 +184,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
})?;
if is_authority {
authority.await;
authority.validate().await;
}
network_starter.start_network();