BlockId removal: refactor: Finalizer (#12528)

* BlockId removal: refactor: Finalizer

It changes the arguments of methods of `Finalizer` trait from:
block: `BlockId<Block>` to: hash: `&Block::Hash`

This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)

* minor corrections

* failing test corrected

* minor rework
This commit is contained in:
Michal Kucharczyk
2022-10-20 08:44:04 +02:00
committed by GitHub
parent 7aadc2aa3c
commit 749bcd1949
16 changed files with 113 additions and 118 deletions
@@ -22,14 +22,14 @@ use sc_client_api::{backend::Finalizer, client::BlockBackend};
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sc_service::client::Client;
use sp_consensus::{BlockOrigin, Error as ConsensusError};
use sp_runtime::{generic::BlockId, traits::Block as BlockT, Justification, Justifications};
use sp_runtime::{traits::Block as BlockT, Justification, Justifications};
/// Extension trait for a test client.
pub trait ClientExt<Block: BlockT>: Sized {
/// Finalize a block.
fn finalize_block(
&self,
id: BlockId<Block>,
hash: &Block::Hash,
justification: Option<Justification>,
) -> sp_blockchain::Result<()>;
@@ -75,10 +75,10 @@ where
{
fn finalize_block(
&self,
id: BlockId<Block>,
hash: &Block::Hash,
justification: Option<Justification>,
) -> sp_blockchain::Result<()> {
Finalizer::finalize_block(self, id, justification, true)
Finalizer::finalize_block(self, hash, justification, true)
}
fn genesis_hash(&self) -> <Block as BlockT>::Hash {