Check block CLI command (#4240)

* Check block operation

* Update client/cli/src/lib.rs

* Update client/cli/src/params.rs
This commit is contained in:
Arkadiy Paronyan
2019-11-28 12:24:28 +01:00
committed by Gavin Wood
parent f78b83e363
commit 504e2f8bd5
22 changed files with 543 additions and 456 deletions
@@ -105,6 +105,8 @@ pub struct BlockCheckParams<Block: BlockT> {
pub parent_hash: Block::Hash,
/// Allow importing the block skipping state verification if parent state is missing.
pub allow_missing_state: bool,
/// Re-validate existing block.
pub import_existing: bool,
}
/// Data required to import a Block.
@@ -142,6 +144,8 @@ pub struct BlockImportParams<Block: BlockT> {
pub fork_choice: ForkChoiceStrategy,
/// Allow importing the block skipping state verification if parent state is missing.
pub allow_missing_state: bool,
/// Re-validate existing block.
pub import_existing: bool,
}
impl<Block: BlockT> BlockImportParams<Block> {
@@ -65,6 +65,8 @@ pub struct IncomingBlock<B: BlockT> {
pub origin: Option<Origin>,
/// Allow importing the block skipping state verification if parent state is missing.
pub allow_missing_state: bool,
/// Re-validate existing block.
pub import_existing: bool,
}
/// Type of keys in the blockchain cache that consensus module could use for its needs.
@@ -230,6 +232,7 @@ pub fn import_single_block<B: BlockT, V: Verifier<B>>(
number,
parent_hash,
allow_missing_state: block.allow_missing_state,
import_existing: block.import_existing,
}))? {
BlockImportResult::ImportedUnknown { .. } => (),
r => return Ok(r), // Any other successful result means that the block is already imported.