mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Fix sync stalling on moving head (best block) prior to the tip of the chain sometimes (#4091)
* Work around finalization woes * Fixed check_block * Added a test
This commit is contained in:
committed by
Gavin Wood
parent
c91d42712a
commit
d40abed4a5
@@ -95,6 +95,7 @@ pub enum ForkChoiceStrategy {
|
||||
}
|
||||
|
||||
/// Data required to check validity of a Block.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct BlockCheckParams<Block: BlockT> {
|
||||
/// Hash of the block that we verify.
|
||||
pub hash: Block::Hash,
|
||||
|
||||
@@ -163,6 +163,8 @@ pub enum BlockImportError {
|
||||
VerificationFailed(Option<Origin>, String),
|
||||
/// Block is known to be Bad
|
||||
BadBlock(Option<Origin>),
|
||||
/// Parent state is missing.
|
||||
MissingState,
|
||||
/// Block has an unknown parent
|
||||
UnknownParent,
|
||||
/// Block import has been cancelled. This can happen if the parent block fails to be imported.
|
||||
@@ -207,7 +209,7 @@ pub fn import_single_block<B: BlockT, V: Verifier<B>>(
|
||||
Ok(ImportResult::Imported(aux)) => Ok(BlockImportResult::ImportedUnknown(number, aux, peer.clone())),
|
||||
Ok(ImportResult::MissingState) => {
|
||||
debug!(target: "sync", "Parent state is missing for {}: {:?}, parent: {:?}", number, hash, parent_hash);
|
||||
Err(BlockImportError::UnknownParent)
|
||||
Err(BlockImportError::MissingState)
|
||||
},
|
||||
Ok(ImportResult::UnknownParent) => {
|
||||
debug!(target: "sync", "Block with unknown parent {}: {:?}, parent: {:?}", number, hash, parent_hash);
|
||||
|
||||
Reference in New Issue
Block a user