mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
BlockId removal: refactor: HeaderBackend::header (#6418)
* BlockId removal: refactor: HeaderBackend::header It changes the arguments of: - `HeaderBackend::header`, - `Client::header` methods from: `BlockId<Block>` to: `Block::Hash` This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * missed fixes * BlockId removal: refactor: HeaderBackend::expect_header It changes the arguments of `HeaderBackend::expect_header` method from: `BlockId<Block>` to: `Block::Hash` * update lockfile for {"substrate"} * misspell fixed Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
f687ab005a
commit
fcc26d42e4
@@ -24,7 +24,7 @@ use sp_consensus_babe::{
|
||||
digests::{PreDigest, SecondaryPlainPreDigest},
|
||||
BABE_ENGINE_ID,
|
||||
};
|
||||
use sp_runtime::{generic::BlockId, Digest, DigestItem};
|
||||
use sp_runtime::{generic::BlockId, traits::Block as BlockT, Digest, DigestItem};
|
||||
use sp_state_machine::BasicExternalities;
|
||||
|
||||
/// An extension for the test client to initialize a Polkadot specific block builder.
|
||||
@@ -42,20 +42,21 @@ pub trait InitPolkadotBlockBuilder {
|
||||
/// which should be the parent block of the block that is being build.
|
||||
fn init_polkadot_block_builder_at(
|
||||
&self,
|
||||
at: &BlockId<Block>,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
) -> sc_block_builder::BlockBuilder<Block, Client, FullBackend>;
|
||||
}
|
||||
|
||||
impl InitPolkadotBlockBuilder for Client {
|
||||
fn init_polkadot_block_builder(&self) -> BlockBuilder<Block, Client, FullBackend> {
|
||||
let chain_info = self.chain_info();
|
||||
self.init_polkadot_block_builder_at(&BlockId::Hash(chain_info.best_hash))
|
||||
self.init_polkadot_block_builder_at(chain_info.best_hash)
|
||||
}
|
||||
|
||||
fn init_polkadot_block_builder_at(
|
||||
&self,
|
||||
at: &BlockId<Block>,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
) -> BlockBuilder<Block, Client, FullBackend> {
|
||||
let at = BlockId::Hash(hash);
|
||||
let last_timestamp =
|
||||
self.runtime_api().get_last_timestamp(&at).expect("Get last timestamp");
|
||||
|
||||
@@ -87,7 +88,7 @@ impl InitPolkadotBlockBuilder for Client {
|
||||
};
|
||||
|
||||
let mut block_builder = self
|
||||
.new_block_at(at, digest, false)
|
||||
.new_block_at(&at, digest, false)
|
||||
.expect("Creates new block builder for test runtime");
|
||||
|
||||
let mut inherent_data = sp_inherents::InherentData::new();
|
||||
@@ -97,7 +98,7 @@ impl InitPolkadotBlockBuilder for Client {
|
||||
.expect("Put timestamp inherent data");
|
||||
|
||||
let parent_header = self
|
||||
.header(at)
|
||||
.header(hash)
|
||||
.expect("Get the parent block header")
|
||||
.expect("The target block header must exist");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user