mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Remove the Future triggering the machine for an async fn
Enables passing data in, such as the network.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{marker::PhantomData, boxed::Box, sync::Arc, future::Future, error::Error};
|
||||
use std::{marker::PhantomData, boxed::Box, sync::Arc, error::Error};
|
||||
|
||||
use sp_runtime::traits::Block as BlockTrait;
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
@@ -14,11 +14,12 @@ use substrate_prometheus_endpoint::Registry;
|
||||
use serai_runtime::{self, opaque::Block, RuntimeApi};
|
||||
|
||||
mod types;
|
||||
use types::{TendermintClientMinimal, TendermintAuthor};
|
||||
use types::{TendermintClientMinimal, TendermintValidator};
|
||||
|
||||
mod validators;
|
||||
|
||||
mod tendermint;
|
||||
pub use tendermint::TendermintAuthority;
|
||||
mod block_import;
|
||||
mod verifier;
|
||||
|
||||
@@ -54,7 +55,7 @@ pub trait Announce<B: BlockTrait>: Send + Sync + Clone + 'static {
|
||||
fn announce(&self, hash: B::Hash);
|
||||
}
|
||||
|
||||
struct Cidp;
|
||||
pub struct Cidp;
|
||||
#[async_trait::async_trait]
|
||||
impl CreateInherentDataProviders<Block, ()> for Cidp {
|
||||
type InherentDataProviders = (sp_timestamp::InherentDataProvider,);
|
||||
@@ -67,15 +68,15 @@ impl CreateInherentDataProviders<Block, ()> for Cidp {
|
||||
}
|
||||
}
|
||||
|
||||
struct TendermintAuthorFirm<A: Announce<Block>>(PhantomData<A>);
|
||||
impl<A: Announce<Block>> TendermintClientMinimal for TendermintAuthorFirm<A> {
|
||||
pub struct TendermintValidatorFirm<A: Announce<Block>>(PhantomData<A>);
|
||||
impl<A: Announce<Block>> TendermintClientMinimal for TendermintValidatorFirm<A> {
|
||||
type Block = Block;
|
||||
type Backend = sc_client_db::Backend<Block>;
|
||||
type Api = <FullClient as ProvideRuntimeApi<Block>>::Api;
|
||||
type Client = FullClient;
|
||||
}
|
||||
|
||||
impl<A: Announce<Block>> TendermintAuthor for TendermintAuthorFirm<A> {
|
||||
impl<A: Announce<Block>> TendermintValidator for TendermintValidatorFirm<A> {
|
||||
type CIDP = Cidp;
|
||||
type Environment = sc_basic_authorship::ProposerFactory<
|
||||
FullPool<Block, FullClient>,
|
||||
@@ -93,8 +94,11 @@ pub fn import_queue<A: Announce<Block>>(
|
||||
announce: A,
|
||||
pool: Arc<FullPool<Block, FullClient>>,
|
||||
registry: Option<&Registry>,
|
||||
) -> (impl Future<Output = ()>, TendermintImportQueue<Block, TransactionFor<FullClient, Block>>) {
|
||||
import_queue::import_queue::<TendermintAuthorFirm<A>>(
|
||||
) -> (
|
||||
TendermintAuthority<TendermintValidatorFirm<A>>,
|
||||
TendermintImportQueue<Block, TransactionFor<FullClient, Block>>,
|
||||
) {
|
||||
import_queue::import_queue::<TendermintValidatorFirm<A>>(
|
||||
client.clone(),
|
||||
announce,
|
||||
Arc::new(Cidp),
|
||||
|
||||
Reference in New Issue
Block a user