Files
serai/substrate/tendermint/client/src/verifier.rs
Luke Parker edb2e00db7 Remove the Future triggering the machine for an async fn
Enables passing data in, such as the network.
2022-10-30 04:08:33 -04:00

24 lines
734 B
Rust

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))
}
}