mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Take in a Keystore and validator ID
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user