mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
BlockId removal: refactor: HeaderBackend::status (#2007)
* BlockId removal: refactor: HeaderBackend::status 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) * update lockfile for {"polkadot", "substrate"} Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
c95ae780f7
commit
525b0cc032
@@ -19,7 +19,7 @@ use std::{pin::Pin, str::FromStr};
|
||||
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
|
||||
use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
|
||||
use futures::{Future, Stream, StreamExt};
|
||||
use polkadot_core_primitives::{Block, BlockId, Hash, Header};
|
||||
use polkadot_core_primitives::{Block, Hash, Header};
|
||||
use polkadot_overseer::RuntimeApiSubsystemClient;
|
||||
use polkadot_service::{AuxStore, HeaderBackend};
|
||||
use sc_authority_discovery::AuthorityDiscovery;
|
||||
@@ -411,21 +411,9 @@ impl HeaderBackend<Block> for BlockChainRpcClient {
|
||||
|
||||
fn status(
|
||||
&self,
|
||||
id: sp_api::BlockId<Block>,
|
||||
hash: <Block as polkadot_service::BlockT>::Hash,
|
||||
) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
|
||||
let exists = match id {
|
||||
BlockId::Hash(hash) => self.header(hash)?.is_some(),
|
||||
BlockId::Number(n) => {
|
||||
let best_header = block_local(self.rpc_client.chain_get_header(None))?;
|
||||
if let Some(best) = best_header {
|
||||
n < best.number
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if exists {
|
||||
if self.header(hash)?.is_some() {
|
||||
Ok(sc_client_api::blockchain::BlockStatus::InChain)
|
||||
} else {
|
||||
Ok(sc_client_api::blockchain::BlockStatus::Unknown)
|
||||
|
||||
Reference in New Issue
Block a user