Take in a Keystore and validator ID

This commit is contained in:
Luke Parker
2022-11-01 20:06:42 -04:00
parent aa0a4cf106
commit 5832007a45
5 changed files with 56 additions and 20 deletions

View File

@@ -1,5 +1,7 @@
use std::sync::Arc;
use sp_core::crypto::KeyTypeId;
use sp_keystore::CryptoStore;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::traits::{Header, Block};
use sp_blockchain::HeaderBackend;
@@ -28,6 +30,7 @@ pub(crate) mod authority;
pub use authority::TendermintAuthority;
const CONSENSUS_ID: [u8; 4] = *b"tend";
const KEY_TYPE_ID: KeyTypeId = KeyTypeId(CONSENSUS_ID);
/// Trait consolidating all generics required by sc_tendermint for processing.
pub trait TendermintClient: Send + Sync + 'static {
@@ -55,6 +58,8 @@ pub trait TendermintClient: Send + Sync + 'static {
+ Finalizer<Self::Block, Self::Backend>
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
+ 'static;
type Keystore: CryptoStore;
}
/// Trait implementable on firm types to automatically provide a full TendermintClient impl.
@@ -72,6 +77,8 @@ pub trait TendermintClientMinimal: Send + Sync + 'static {
+ Finalizer<Self::Block, Self::Backend>
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
+ 'static;
type Keystore: CryptoStore;
}
impl<T: TendermintClientMinimal> TendermintClient for T
@@ -89,6 +96,8 @@ where
type StateBackend = StateBackendFor<T::Client, T::Block>;
type Api = <T::Client as ProvideRuntimeApi<T::Block>>::Api;
type Client = T::Client;
type Keystore = T::Keystore;
}
/// Trait consolidating additional generics required by sc_tendermint for authoring.