mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
BlockId removal: refactor: BlockBackend::block|block_status (#13014)
* 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) * non-obvious reworks * doc fix * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
66cfd01f17
commit
9c69fc1b32
@@ -29,10 +29,7 @@ use futures::{
|
||||
use jsonrpsee::SubscriptionSink;
|
||||
use sc_client_api::{BlockBackend, BlockchainEvents};
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_runtime::{
|
||||
generic::{BlockId, SignedBlock},
|
||||
traits::Block as BlockT,
|
||||
};
|
||||
use sp_runtime::{generic::SignedBlock, traits::Block as BlockT};
|
||||
|
||||
/// Blockchain API backend for full nodes. Reads all the data from local database.
|
||||
pub struct FullChain<Block: BlockT, Client> {
|
||||
@@ -66,7 +63,7 @@ where
|
||||
}
|
||||
|
||||
fn block(&self, hash: Option<Block::Hash>) -> Result<Option<SignedBlock<Block>>, Error> {
|
||||
self.client.block(&BlockId::Hash(self.unwrap_or_best(hash))).map_err(client_err)
|
||||
self.client.block(self.unwrap_or_best(hash)).map_err(client_err)
|
||||
}
|
||||
|
||||
fn subscribe_all_heads(&self, sink: SubscriptionSink) {
|
||||
|
||||
@@ -69,10 +69,7 @@ where
|
||||
self.deny_unsafe.check_if_safe()?;
|
||||
|
||||
let block = {
|
||||
let block = self
|
||||
.client
|
||||
.block(&BlockId::Hash(hash))
|
||||
.map_err(|e| Error::BlockQueryError(Box::new(e)))?;
|
||||
let block = self.client.block(hash).map_err(|e| Error::BlockQueryError(Box::new(e)))?;
|
||||
if let Some(block) = block {
|
||||
let (mut header, body) = block.block.deconstruct();
|
||||
// Remove the `Seal` to ensure we have the number of digests as expected by the
|
||||
|
||||
Reference in New Issue
Block a user