mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +00:00
BlockId removal: refactor: Backend::body (#12587)
It changes the arguments of `Backend::body` 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
c68bd397d8
commit
76bcbd09a5
@@ -550,12 +550,12 @@ impl<N: Clone + Copy + AtLeast32Bit> RevalidationStatus<N> {
|
||||
|
||||
/// Prune the known txs for the given block.
|
||||
async fn prune_known_txs_for_block<Block: BlockT, Api: graph::ChainApi<Block = Block>>(
|
||||
block_id: BlockId<Block>,
|
||||
block_hash: &Block::Hash,
|
||||
api: &Api,
|
||||
pool: &graph::Pool<Api>,
|
||||
) -> Vec<ExtrinsicHash<Api>> {
|
||||
let extrinsics = api
|
||||
.block_body(&block_id)
|
||||
.block_body(&block_hash)
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
log::warn!("Prune known transactions: error request: {}", e);
|
||||
@@ -567,19 +567,21 @@ async fn prune_known_txs_for_block<Block: BlockT, Api: graph::ChainApi<Block = B
|
||||
|
||||
log::trace!(target: "txpool", "Pruning transactions: {:?}", hashes);
|
||||
|
||||
let header = match api.block_header(&block_id) {
|
||||
let header = match api.block_header(&BlockId::Hash(*block_hash)) {
|
||||
Ok(Some(h)) => h,
|
||||
Ok(None) => {
|
||||
log::debug!(target: "txpool", "Could not find header for {:?}.", block_id);
|
||||
log::debug!(target: "txpool", "Could not find header for {:?}.", block_hash);
|
||||
return hashes
|
||||
},
|
||||
Err(e) => {
|
||||
log::debug!(target: "txpool", "Error retrieving header for {:?}: {}", block_id, e);
|
||||
log::debug!(target: "txpool", "Error retrieving header for {:?}: {}", block_hash, e);
|
||||
return hashes
|
||||
},
|
||||
};
|
||||
|
||||
if let Err(e) = pool.prune(&block_id, &BlockId::hash(*header.parent_hash()), &extrinsics).await
|
||||
if let Err(e) = pool
|
||||
.prune(&BlockId::Hash(*block_hash), &BlockId::hash(*header.parent_hash()), &extrinsics)
|
||||
.await
|
||||
{
|
||||
log::error!("Cannot prune known in the pool: {}", e);
|
||||
}
|
||||
@@ -636,7 +638,7 @@ where
|
||||
tree_route
|
||||
.enacted()
|
||||
.iter()
|
||||
.map(|h| prune_known_txs_for_block(BlockId::Hash(h.hash), &*api, &*pool)),
|
||||
.map(|h| prune_known_txs_for_block(&h.hash, &*api, &*pool)),
|
||||
)
|
||||
.await
|
||||
.into_iter()
|
||||
@@ -654,7 +656,7 @@ where
|
||||
let hash = retracted.hash;
|
||||
|
||||
let block_transactions = api
|
||||
.block_body(&BlockId::hash(hash))
|
||||
.block_body(&hash)
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
log::warn!("Failed to fetch block body: {}", e);
|
||||
|
||||
Reference in New Issue
Block a user