mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +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
cb53fd5255
commit
394abf5e58
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.
|
/// 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 {
|
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) => {
|
Ok(BlockStatus::Queued) => {
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ use sc_client_api::{
|
|||||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
|
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
|
||||||
use sp_blockchain::Error as ClientError;
|
use sp_blockchain::Error as ClientError;
|
||||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||||
use sp_runtime::{
|
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||||
generic::BlockId,
|
|
||||||
traits::{Block as BlockT, Header as HeaderT},
|
|
||||||
};
|
|
||||||
|
|
||||||
use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest};
|
use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest};
|
||||||
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
|
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
|
||||||
@@ -283,7 +280,7 @@ async fn handle_new_block_imported<Block, P>(
|
|||||||
unset_best_header.hash()
|
unset_best_header.hash()
|
||||||
};
|
};
|
||||||
|
|
||||||
match parachain.block_status(&BlockId::Hash(unset_hash)) {
|
match parachain.block_status(unset_hash) {
|
||||||
Ok(BlockStatus::InChainWithState) => {
|
Ok(BlockStatus::InChainWithState) => {
|
||||||
drop(unset_best_header);
|
drop(unset_best_header);
|
||||||
let unset_best_header = unset_best_header_opt
|
let unset_best_header = unset_best_header_opt
|
||||||
@@ -335,7 +332,7 @@ async fn handle_new_best_parachain_head<Block, P>(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Make sure the block is already known or otherwise we skip setting new best.
|
// 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) => {
|
Ok(BlockStatus::InChainWithState) => {
|
||||||
unset_best_header.take();
|
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();
|
new_best_heads_sender.unbounded_send(block.header().clone()).unwrap();
|
||||||
loop {
|
loop {
|
||||||
Delay::new(Duration::from_millis(100)).await;
|
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 => {},
|
BlockStatus::Unknown => {},
|
||||||
status => {
|
status => {
|
||||||
assert_eq!(block.hash(), client.usage_info().chain.best_hash);
|
assert_eq!(block.hash(), client.usage_info().chain.best_hash);
|
||||||
|
|||||||
@@ -44,10 +44,7 @@
|
|||||||
use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider};
|
use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider};
|
||||||
use sc_consensus::import_queue::{ImportQueueService, IncomingBlock};
|
use sc_consensus::import_queue::{ImportQueueService, IncomingBlock};
|
||||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||||
use sp_runtime::{
|
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||||
generic::BlockId,
|
|
||||||
traits::{Block as BlockT, Header as HeaderT, NumberFor},
|
|
||||||
};
|
|
||||||
|
|
||||||
use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT};
|
use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT};
|
||||||
use polkadot_overseer::Handle as OverseerHandle;
|
use polkadot_overseer::Handle as OverseerHandle;
|
||||||
@@ -303,7 +300,7 @@ where
|
|||||||
|
|
||||||
let parent = *block.header().parent_hash();
|
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) => {
|
Ok(BlockStatus::Unknown) => {
|
||||||
if self.active_candidate_recovery.is_being_recovered(&parent) {
|
if self.active_candidate_recovery.is_being_recovered(&parent) {
|
||||||
tracing::debug!(
|
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 => {
|
Ok(BlockStatus::Unknown) if !candidate.waiting_recovery => {
|
||||||
candidate.waiting_recovery = true;
|
candidate.waiting_recovery = true;
|
||||||
to_recover.push(hash);
|
to_recover.push(hash);
|
||||||
|
|||||||
Reference in New Issue
Block a user