relay-chain-consensus: set a fork_choice (#2462)

After #2001 the `fork_choice` strategy may remain uninitialized in the
block import pipeline which uses relay-chain verifier.
Refer to
https://github.com/paritytech/polkadot-sdk/pull/2430#issuecomment-1823979813
for some further discussion.
This commit is contained in:
Michal Kucharczyk
2023-11-24 14:06:19 +01:00
committed by GitHub
parent 7554f53f9e
commit 891628a7f1
@@ -55,6 +55,10 @@ where
&mut self,
mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
block_params.fork_choice = Some(sc_consensus::ForkChoiceStrategy::Custom(
block_params.origin == sp_consensus::BlockOrigin::NetworkInitialSync,
));
// Skip checks that include execution, if being told so, or when importing only state.
//
// This is done for example when gap syncing and it is expected that the block after the gap
@@ -100,7 +104,6 @@ where
}
block_params.post_hash = Some(block_params.header.hash());
Ok(block_params)
}
}