mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
BlockId removal: refactor: HeaderBackend::status (#12981)
It changes the arguments of `HeaderBackend::status` method from: `BlockId<Block>` to: `Block::Hash` This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
8d95737f41
commit
c237b82690
@@ -553,12 +553,8 @@ impl<Block: BlockT> sc_client_api::blockchain::HeaderBackend<Block> for Blockcha
|
||||
}
|
||||
}
|
||||
|
||||
fn status(&self, id: BlockId<Block>) -> ClientResult<sc_client_api::blockchain::BlockStatus> {
|
||||
let exists = match id {
|
||||
BlockId::Hash(hash) => self.header(hash)?.is_some(),
|
||||
BlockId::Number(n) => n <= self.meta.read().best_number,
|
||||
};
|
||||
match exists {
|
||||
fn status(&self, hash: Block::Hash) -> ClientResult<sc_client_api::blockchain::BlockStatus> {
|
||||
match self.header(hash)?.is_some() {
|
||||
true => Ok(sc_client_api::blockchain::BlockStatus::InChain),
|
||||
false => Ok(sc_client_api::blockchain::BlockStatus::Unknown),
|
||||
}
|
||||
@@ -1223,7 +1219,7 @@ impl<Block: BlockT> Backend<Block> {
|
||||
}
|
||||
|
||||
let parent_exists =
|
||||
self.blockchain.status(BlockId::Hash(route_to))? == sp_blockchain::BlockStatus::InChain;
|
||||
self.blockchain.status(route_to)? == sp_blockchain::BlockStatus::InChain;
|
||||
|
||||
// Cannot find tree route with empty DB or when imported a detached block.
|
||||
if meta.best_hash != Default::default() && parent_exists {
|
||||
|
||||
Reference in New Issue
Block a user