Skip to content

Commit

Permalink
relay-chain-consensus: set a fork_choice (#2462)
Browse files Browse the repository at this point in the history
After #2001 the `fork_choice` strategy may remain uninitialized in the
block import pipeline which uses relay-chain verifier.
Refer to
#2430 (comment)
for some further discussion.
  • Loading branch information
michalkucharczyk authored Nov 24, 2023
1 parent 7554f53 commit 891628a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cumulus/client/consensus/relay-chain/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,7 +104,6 @@ where
}

block_params.post_hash = Some(block_params.header.hash());

Ok(block_params)
}
}
Expand Down

0 comments on commit 891628a

Please sign in to comment.