Consolidate C and I generics into a TendermintClient trait alias

This commit is contained in:
Luke Parker
2022-10-24 04:43:25 -04:00
parent 4859e8c27e
commit b6dddc469f
5 changed files with 71 additions and 48 deletions

View File

@@ -1,29 +1,34 @@
use std::sync::Arc;
use async_trait::async_trait;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::traits::Block;
use sp_blockchain::HeaderBackend;
use sp_api::{TransactionFor, ProvideRuntimeApi};
use sp_api::TransactionFor;
use sp_consensus::{CacheKeyId, Environment};
use sc_consensus::{BlockImportParams, Verifier, BlockImport};
use sp_consensus::{Error, CacheKeyId, Environment};
use sc_consensus::{BlockImportParams, BlockImport, Verifier};
use sc_client_api::{Backend, Finalizer};
use sc_client_api::Backend;
use crate::{tendermint::TendermintImport, Announce};
use crate::{
tendermint::{TendermintClient, TendermintImport},
Announce,
};
#[async_trait]
impl<
B: Block,
Be: Backend<B> + 'static,
C: Send + Sync + HeaderBackend<B> + Finalizer<B, Be> + ProvideRuntimeApi<B> + 'static,
I: Send + Sync + BlockImport<B, Transaction = TransactionFor<C, B>> + 'static,
C: TendermintClient<B, Be>,
CIDP: CreateInherentDataProviders<B, ()> + 'static,
E: Send + Sync + Environment<B> + 'static,
A: Announce<B>,
> Verifier<B> for TendermintImport<B, Be, C, I, CIDP, E, A>
> Verifier<B> for TendermintImport<B, Be, C, CIDP, E, A>
where
TransactionFor<C, B>: Send + Sync + 'static,
Arc<C>: BlockImport<B, Transaction = TransactionFor<C, B>>,
<Arc<C> as BlockImport<B>>::Error: Into<Error>,
{
async fn verify(
&mut self,