ImportBlock -> BlockImportParams (#3158)

This commit is contained in:
Pierre Krieger
2019-07-22 00:43:02 +02:00
committed by DemiMarie-parity
parent 4bbfaa9c8f
commit 2edeef5825
16 changed files with 53 additions and 53 deletions
@@ -97,7 +97,7 @@ pub enum ForkChoiceStrategy {
}
/// Data required to import a Block
pub struct ImportBlock<Block: BlockT> {
pub struct BlockImportParams<Block: BlockT> {
/// Origin of the Block
pub origin: BlockOrigin,
/// The header, without consensus post-digests applied. This should be in the same
@@ -130,7 +130,7 @@ pub struct ImportBlock<Block: BlockT> {
pub fork_choice: ForkChoiceStrategy,
}
impl<Block: BlockT> ImportBlock<Block> {
impl<Block: BlockT> BlockImportParams<Block> {
/// Deconstruct the justified header into parts.
pub fn into_inner(self)
-> (
@@ -186,7 +186,7 @@ pub trait BlockImport<B: BlockT> {
/// Cached data can be accessed through the blockchain cache.
fn import_block(
&mut self,
block: ImportBlock<B>,
block: BlockImportParams<B>,
cache: HashMap<well_known_cache_keys::Id, Vec<u8>>,
) -> Result<ImportResult, Self::Error>;
}
@@ -206,7 +206,7 @@ where for<'r> &'r T: BlockImport<B, Error = E>
fn import_block(
&mut self,
block: ImportBlock<B>,
block: BlockImportParams<B>,
cache: HashMap<well_known_cache_keys::Id, Vec<u8>>,
) -> Result<ImportResult, Self::Error> {
(&**self).import_block(block, cache)
@@ -29,7 +29,7 @@ use std::{sync::Arc, collections::HashMap};
use runtime_primitives::{Justification, traits::{Block as BlockT, Header as _, NumberFor}};
use crate::{error::Error as ConsensusError, well_known_cache_keys::Id as CacheKeyId};
use crate::block_import::{
BlockImport, BlockOrigin, ImportBlock, ImportedAux, JustificationImport, ImportResult,
BlockImport, BlockOrigin, BlockImportParams, ImportedAux, JustificationImport, ImportResult,
FinalityProofImport,
};
@@ -67,7 +67,7 @@ pub struct IncomingBlock<B: BlockT> {
/// Verify a justification of a block
pub trait Verifier<B: BlockT>: Send + Sync {
/// Verify the given data and return the ImportBlock and an optional
/// Verify the given data and return the BlockImportParams and an optional
/// new set of validators to import. If not, err with an Error-Message
/// presented to the User in the logs.
fn verify(
@@ -76,7 +76,7 @@ pub trait Verifier<B: BlockT>: Send + Sync {
header: B::Header,
justification: Option<Justification>,
body: Option<Vec<B::Extrinsic>>,
) -> Result<(ImportBlock<B>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String>;
) -> Result<(BlockImportParams<B>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String>;
}
/// Blocks import queue API.
+1 -1
View File
@@ -47,7 +47,7 @@ const MAX_BLOCK_SIZE: usize = 4 * 1024 * 1024 + 512;
pub use self::error::Error;
pub use block_import::{
BlockImport, BlockOrigin, ForkChoiceStrategy, ImportedAux, ImportBlock, ImportResult,
BlockImport, BlockOrigin, ForkChoiceStrategy, ImportedAux, BlockImportParams, ImportResult,
JustificationImport, FinalityProofImport,
};
pub use select_chain::SelectChain;