BlockId removal: refactor: BlockBackend::block|block_status (#2041)

* BlockId removal: refactor: BlockBackend::block|block_status

It changes the arguments of:
-  `BlockBackend::block`
-  `BlockBackend::block_status`

method from: `BlockId<Block>` to: `Block::Hash`

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

* update lockfile for {"polkadot", "substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-01-02 13:32:51 +01:00
committed by GitHub
parent 847e1c00a2
commit 37aa2a8c5d
5 changed files with 311 additions and 288 deletions
@@ -21,10 +21,7 @@ use sc_client_api::{
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sp_blockchain::Error as ClientError;
use sp_consensus::{BlockOrigin, BlockStatus};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT},
};
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest};
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
@@ -283,7 +280,7 @@ async fn handle_new_block_imported<Block, P>(
unset_best_header.hash()
};
match parachain.block_status(&BlockId::Hash(unset_hash)) {
match parachain.block_status(unset_hash) {
Ok(BlockStatus::InChainWithState) => {
drop(unset_best_header);
let unset_best_header = unset_best_header_opt
@@ -335,7 +332,7 @@ async fn handle_new_best_parachain_head<Block, P>(
)
} else {
// Make sure the block is already known or otherwise we skip setting new best.
match parachain.block_status(&BlockId::Hash(hash)) {
match parachain.block_status(hash) {
Ok(BlockStatus::InChainWithState) => {
unset_best_header.take();
+1 -1
View File
@@ -241,7 +241,7 @@ fn follow_new_best_with_dummy_recovery_works() {
new_best_heads_sender.unbounded_send(block.header().clone()).unwrap();
loop {
Delay::new(Duration::from_millis(100)).await;
match client.block_status(&BlockId::Hash(block.hash())).unwrap() {
match client.block_status(block.hash()).unwrap() {
BlockStatus::Unknown => {},
status => {
assert_eq!(block.hash(), client.usage_info().chain.best_hash);