mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +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
Generated
+253
-253
File diff suppressed because it is too large
Load Diff
@@ -265,9 +265,7 @@ where
|
|||||||
{
|
{
|
||||||
let _lock = backend.get_import_lock().read();
|
let _lock = backend.get_import_lock().read();
|
||||||
|
|
||||||
let block_id = BlockId::Hash(hash);
|
if backend.blockchain().status(hash)? == BlockStatus::InChain {
|
||||||
|
|
||||||
if backend.blockchain().status(block_id)? == BlockStatus::InChain {
|
|
||||||
return Ok(BlockCheckStatus::InChain)
|
return Ok(BlockCheckStatus::InChain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use std::{pin::Pin, str::FromStr};
|
|||||||
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
|
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
|
||||||
use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
|
use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
|
||||||
use futures::{Future, Stream, StreamExt};
|
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_overseer::RuntimeApiSubsystemClient;
|
||||||
use polkadot_service::{AuxStore, HeaderBackend};
|
use polkadot_service::{AuxStore, HeaderBackend};
|
||||||
use sc_authority_discovery::AuthorityDiscovery;
|
use sc_authority_discovery::AuthorityDiscovery;
|
||||||
@@ -411,21 +411,9 @@ impl HeaderBackend<Block> for BlockChainRpcClient {
|
|||||||
|
|
||||||
fn status(
|
fn status(
|
||||||
&self,
|
&self,
|
||||||
id: sp_api::BlockId<Block>,
|
hash: <Block as polkadot_service::BlockT>::Hash,
|
||||||
) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
|
) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
|
||||||
let exists = match id {
|
if self.header(hash)?.is_some() {
|
||||||
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 {
|
|
||||||
Ok(sc_client_api::blockchain::BlockStatus::InChain)
|
Ok(sc_client_api::blockchain::BlockStatus::InChain)
|
||||||
} else {
|
} else {
|
||||||
Ok(sc_client_api::blockchain::BlockStatus::Unknown)
|
Ok(sc_client_api::blockchain::BlockStatus::Unknown)
|
||||||
|
|||||||
Reference in New Issue
Block a user