mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 12:48:00 +00:00
BlockId removal: refactor: BlockBackend::block|block_status (#2041)
* 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 {"polkadot", "substrate"} Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
847e1c00a2
commit
37aa2a8c5d
Generated
+303
-274
File diff suppressed because it is too large
Load Diff
@@ -91,7 +91,7 @@ where
|
||||
///
|
||||
/// Returns `true` if the block could be found and is good to be build on.
|
||||
fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool {
|
||||
match self.block_status.block_status(&BlockId::Hash(hash)) {
|
||||
match self.block_status.block_status(hash) {
|
||||
Ok(BlockStatus::Queued) => {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
@@ -21,10 +21,7 @@ use sc_client_api::{
|
||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT},
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
|
||||
use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest};
|
||||
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
|
||||
@@ -283,7 +280,7 @@ async fn handle_new_block_imported<Block, P>(
|
||||
unset_best_header.hash()
|
||||
};
|
||||
|
||||
match parachain.block_status(&BlockId::Hash(unset_hash)) {
|
||||
match parachain.block_status(unset_hash) {
|
||||
Ok(BlockStatus::InChainWithState) => {
|
||||
drop(unset_best_header);
|
||||
let unset_best_header = unset_best_header_opt
|
||||
@@ -335,7 +332,7 @@ async fn handle_new_best_parachain_head<Block, P>(
|
||||
)
|
||||
} else {
|
||||
// Make sure the block is already known or otherwise we skip setting new best.
|
||||
match parachain.block_status(&BlockId::Hash(hash)) {
|
||||
match parachain.block_status(hash) {
|
||||
Ok(BlockStatus::InChainWithState) => {
|
||||
unset_best_header.take();
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ fn follow_new_best_with_dummy_recovery_works() {
|
||||
new_best_heads_sender.unbounded_send(block.header().clone()).unwrap();
|
||||
loop {
|
||||
Delay::new(Duration::from_millis(100)).await;
|
||||
match client.block_status(&BlockId::Hash(block.hash())).unwrap() {
|
||||
match client.block_status(block.hash()).unwrap() {
|
||||
BlockStatus::Unknown => {},
|
||||
status => {
|
||||
assert_eq!(block.hash(), client.usage_info().chain.best_hash);
|
||||
|
||||
@@ -44,10 +44,7 @@
|
||||
use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider};
|
||||
use sc_consensus::import_queue::{ImportQueueService, IncomingBlock};
|
||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT, NumberFor},
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
|
||||
use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT};
|
||||
use polkadot_overseer::Handle as OverseerHandle;
|
||||
@@ -303,7 +300,7 @@ where
|
||||
|
||||
let parent = *block.header().parent_hash();
|
||||
|
||||
match self.parachain_client.block_status(&BlockId::hash(parent)) {
|
||||
match self.parachain_client.block_status(parent) {
|
||||
Ok(BlockStatus::Unknown) => {
|
||||
if self.active_candidate_recovery.is_being_recovered(&parent) {
|
||||
tracing::debug!(
|
||||
@@ -402,7 +399,7 @@ where
|
||||
},
|
||||
};
|
||||
|
||||
match self.parachain_client.block_status(&BlockId::Hash(hash)) {
|
||||
match self.parachain_client.block_status(hash) {
|
||||
Ok(BlockStatus::Unknown) if !candidate.waiting_recovery => {
|
||||
candidate.waiting_recovery = true;
|
||||
to_recover.push(hash);
|
||||
|
||||
Reference in New Issue
Block a user