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

* 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 {"substrate"}

* ".git/.scripts/fmt.sh"

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-01-02 12:56:26 +01:00
committed by GitHub
parent 539a9a9158
commit 01fcc27465
2 changed files with 189 additions and 185 deletions
+181 -180
View File
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -29,7 +29,7 @@ use sp_api::{CallApiAt, Encode, NumberFor, ProvideRuntimeApi};
use sp_blockchain::{HeaderBackend, HeaderMetadata};
use sp_consensus::BlockStatus;
use sp_runtime::{
generic::{BlockId, SignedBlock},
generic::SignedBlock,
traits::{BlakeTwo256, Block as BlockT},
Justifications,
};
@@ -338,22 +338,25 @@ impl sc_client_api::BlockBackend<Block> for Client {
}
}
fn block(&self, id: &BlockId<Block>) -> sp_blockchain::Result<Option<SignedBlock<Block>>> {
fn block(
&self,
hash: <Block as BlockT>::Hash,
) -> sp_blockchain::Result<Option<SignedBlock<Block>>> {
with_client! {
self,
client,
{
client.block(id)
client.block(hash)
}
}
}
fn block_status(&self, id: &BlockId<Block>) -> sp_blockchain::Result<BlockStatus> {
fn block_status(&self, hash: <Block as BlockT>::Hash) -> sp_blockchain::Result<BlockStatus> {
with_client! {
self,
client,
{
client.block_status(id)
client.block_status(hash)
}
}
}