mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 02:08:02 +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
@@ -38,6 +38,10 @@ pub trait ClientExt<Block: BlockT>: Sized {
|
||||
fn import_as_best(&self, origin: BlockOrigin, block: Block)
|
||||
-> Result<(), ConsensusError>;
|
||||
|
||||
/// Import a block and finalize it.
|
||||
fn import_as_final(&self, origin: BlockOrigin, block: Block)
|
||||
-> Result<(), ConsensusError>;
|
||||
|
||||
/// Import block with justification, finalizes block.
|
||||
fn import_justified(
|
||||
&self,
|
||||
@@ -102,6 +106,25 @@ impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA>
|
||||
BlockImport::import_block(&mut (&*self), import, HashMap::new()).map(|_| ())
|
||||
}
|
||||
|
||||
fn import_as_final(&self, origin: BlockOrigin, block: Block)
|
||||
-> Result<(), ConsensusError>
|
||||
{
|
||||
let (header, extrinsics) = block.deconstruct();
|
||||
let import = BlockImportParams {
|
||||
origin,
|
||||
header,
|
||||
justification: None,
|
||||
post_digests: vec![],
|
||||
body: Some(extrinsics),
|
||||
finalized: true,
|
||||
auxiliary: Vec::new(),
|
||||
fork_choice: ForkChoiceStrategy::Custom(true),
|
||||
allow_missing_state: false,
|
||||
};
|
||||
|
||||
BlockImport::import_block(&mut (&*self), import, HashMap::new()).map(|_| ())
|
||||
}
|
||||
|
||||
fn import_justified(
|
||||
&self,
|
||||
origin: BlockOrigin,
|
||||
|
||||
Reference in New Issue
Block a user