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

* 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)

* non-obvious reworks

* doc fix

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-01-02 10:42:05 +01:00
committed by GitHub
parent 66cfd01f17
commit 9c69fc1b32
12 changed files with 75 additions and 101 deletions
+6 -7
View File
@@ -21,7 +21,7 @@
use sp_consensus::BlockOrigin;
use sp_core::storage::StorageKey;
use sp_runtime::{
generic::{BlockId, SignedBlock},
generic::SignedBlock,
traits::{Block as BlockT, NumberFor},
Justifications,
};
@@ -120,14 +120,13 @@ pub trait BlockBackend<Block: BlockT> {
/// that are indexed by the runtime with `storage_index_transaction`.
fn block_indexed_body(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<Vec<Vec<u8>>>>;
/// Get full block by id.
fn block(&self, id: &BlockId<Block>) -> sp_blockchain::Result<Option<SignedBlock<Block>>>;
/// Get full block by hash.
fn block(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<SignedBlock<Block>>>;
/// Get block status.
fn block_status(&self, id: &BlockId<Block>)
-> sp_blockchain::Result<sp_consensus::BlockStatus>;
/// Get block status by block hash.
fn block_status(&self, hash: Block::Hash) -> sp_blockchain::Result<sp_consensus::BlockStatus>;
/// Get block justifications for the block with the given id.
/// Get block justifications for the block with the given hash.
fn justifications(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<Justifications>>;
/// Get block hash by number.