mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 11:17:56 +00:00
sc-network-test::Peer: block push methods return hashes vec (#12944)
* sc-network-test::Peer: block push methods return hashes vec This commit reworks the block generation/push methods in sc-network-test::Peer. Now methods are providing the vector of hashes that were built. This allows to get rid of redundant `block_hash_from_id` call, as all hashes are known just after being built. Similar approach was taken in BeefyTestNet::generate_blocks_and_sync method. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * fix * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
40c04cf11d
commit
1be51ccb5c
@@ -34,7 +34,7 @@ use std::borrow::Cow;
|
||||
|
||||
use node_primitives::Block;
|
||||
use node_testing::bench::{BenchDb, BlockType, DatabaseType, KeyTypes, Profile};
|
||||
use sc_client_api::{backend::Backend, HeaderBackend};
|
||||
use sc_client_api::backend::Backend;
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_state_machine::InspectState;
|
||||
|
||||
@@ -127,15 +127,10 @@ impl core::Benchmark for ImportBenchmark {
|
||||
context.import_block(self.block.clone());
|
||||
let elapsed = start.elapsed();
|
||||
|
||||
let hash = context
|
||||
.client
|
||||
.expect_block_hash_from_id(&BlockId::number(1))
|
||||
.expect("Block 1 was imported; qed");
|
||||
|
||||
// Sanity checks.
|
||||
context
|
||||
.client
|
||||
.state_at(hash)
|
||||
.state_at(self.block.header.hash())
|
||||
.expect("state_at failed for block#1")
|
||||
.inspect_state(|| {
|
||||
match self.block_type {
|
||||
|
||||
Reference in New Issue
Block a user