BlockId removal: refactor: HeaderBackend::header (#6418)

* BlockId removal: refactor: HeaderBackend::header

It changes the arguments of:
- `HeaderBackend::header`,
- `Client::header`

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

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

* missed fixes

* BlockId removal: refactor: HeaderBackend::expect_header

It changes the arguments of `HeaderBackend::expect_header` method from: `BlockId<Block>` to: `Block::Hash`

* update lockfile for {"substrate"}

* misspell fixed

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2022-12-20 12:00:13 +01:00
committed by GitHub
parent f687ab005a
commit fcc26d42e4
10 changed files with 228 additions and 237 deletions
+3 -6
View File
@@ -41,7 +41,7 @@ use polkadot_node_subsystem::{
messages::ChainApiMessage, overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem,
SubsystemError, SubsystemResult,
};
use polkadot_primitives::v2::{Block, BlockId};
use polkadot_primitives::v2::Block;
mod metrics;
use self::metrics::Metrics;
@@ -99,10 +99,7 @@ where
},
ChainApiMessage::BlockHeader(hash, response_channel) => {
let _timer = subsystem.metrics.time_block_header();
let result = subsystem
.client
.header(BlockId::Hash(hash))
.map_err(|e| e.to_string().into());
let result = subsystem.client.header(hash).map_err(|e| e.to_string().into());
subsystem.metrics.on_request(result.is_ok());
let _ = response_channel.send(result);
},
@@ -134,7 +131,7 @@ where
let mut hash = hash;
let next_parent = core::iter::from_fn(|| {
let maybe_header = subsystem.client.header(BlockId::Hash(hash));
let maybe_header = subsystem.client.header(hash);
match maybe_header {
// propagate the error
Err(e) => {