mirror of
https://github.com/serai-dex/serai.git
synced 2025-02-03 11:46:31 +00:00
Merge Verifier into block_import.rs
These two files were largely the same, just hooking into sync structs with almost identical imports. As this project shapes up, removing dead weight is appreciated.
This commit is contained in:
parent
f37adf4feb
commit
066bc40a88
3 changed files with 16 additions and 25 deletions
|
@ -3,7 +3,7 @@ use std::{sync::Arc, collections::HashMap};
|
|||
use async_trait::async_trait;
|
||||
|
||||
use sp_consensus::{Error, CacheKeyId};
|
||||
use sc_consensus::{BlockCheckParams, BlockImportParams, ImportResult, BlockImport};
|
||||
use sc_consensus::{BlockCheckParams, BlockImportParams, ImportResult, BlockImport, Verifier};
|
||||
|
||||
use crate::{types::TendermintValidator, tendermint::TendermintImport};
|
||||
|
||||
|
@ -45,3 +45,18 @@ where
|
|||
// machine with the new height
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<T: TendermintValidator> Verifier<T::Block> for TendermintImport<T>
|
||||
where
|
||||
Arc<T::Client>: BlockImport<T::Block, Transaction = T::BackendTransaction>,
|
||||
<Arc<T::Client> as BlockImport<T::Block>>::Error: Into<Error>,
|
||||
{
|
||||
async fn verify(
|
||||
&mut self,
|
||||
mut block: BlockImportParams<T::Block, ()>,
|
||||
) -> Result<(BlockImportParams<T::Block, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
|
||||
self.check(&mut block).await.map_err(|e| format!("{}", e))?;
|
||||
Ok((block, None))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ mod validators;
|
|||
mod tendermint;
|
||||
pub use tendermint::TendermintAuthority;
|
||||
mod block_import;
|
||||
mod verifier;
|
||||
|
||||
mod import_queue;
|
||||
use import_queue::TendermintImportQueue;
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use sp_consensus::{Error, CacheKeyId};
|
||||
use sc_consensus::{BlockImportParams, BlockImport, Verifier};
|
||||
|
||||
use crate::{types::TendermintValidator, tendermint::TendermintImport};
|
||||
|
||||
#[async_trait]
|
||||
impl<T: TendermintValidator> Verifier<T::Block> for TendermintImport<T>
|
||||
where
|
||||
Arc<T::Client>: BlockImport<T::Block, Transaction = T::BackendTransaction>,
|
||||
<Arc<T::Client> as BlockImport<T::Block>>::Error: Into<Error>,
|
||||
{
|
||||
async fn verify(
|
||||
&mut self,
|
||||
mut block: BlockImportParams<T::Block, ()>,
|
||||
) -> Result<(BlockImportParams<T::Block, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
|
||||
self.check(&mut block).await.map_err(|e| format!("{}", e))?;
|
||||
Ok((block, None))
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue