mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 02:57:57 +00:00
BlockId removal: tx-pool refactor (#1678)
It changes following APIs: - trait `ChainApi` -- `validate_transaction` - trait `TransactionPool` --`submit_at` --`submit_one` --`submit_and_watch` and some implementation details, in particular: - impl `Pool` --`submit_at` --`resubmit_at` --`submit_one` --`submit_and_watch` --`prune_known` --`prune` --`prune_tags` --`resolve_block_number` --`verify` --`verify_one` - revalidation queue All tests are also adjusted. --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
a846b74604
commit
ab3a3bc278
@@ -35,7 +35,7 @@ use sc_transaction_pool_api::{
|
||||
};
|
||||
use sp_consensus::{Environment, Proposer};
|
||||
use sp_inherents::InherentDataProvider;
|
||||
use sp_runtime::{generic::BlockId, traits::NumberFor, OpaqueExtrinsic};
|
||||
use sp_runtime::{traits::NumberFor, OpaqueExtrinsic};
|
||||
|
||||
use crate::{
|
||||
common::SizeType,
|
||||
@@ -233,7 +233,7 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
|
||||
/// Returns a future that imports a bunch of unverified transactions to the pool.
|
||||
fn submit_at(
|
||||
&self,
|
||||
_at: &BlockId<Self::Block>,
|
||||
_at: Self::Hash,
|
||||
_source: TransactionSource,
|
||||
_xts: Vec<TransactionFor<Self>>,
|
||||
) -> PoolFuture<Vec<Result<node_primitives::Hash, Self::Error>>, Self::Error> {
|
||||
@@ -243,7 +243,7 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
|
||||
/// Returns a future that imports one unverified transaction to the pool.
|
||||
fn submit_one(
|
||||
&self,
|
||||
_at: &BlockId<Self::Block>,
|
||||
_at: Self::Hash,
|
||||
_source: TransactionSource,
|
||||
_xt: TransactionFor<Self>,
|
||||
) -> PoolFuture<TxHash<Self>, Self::Error> {
|
||||
@@ -252,7 +252,7 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
|
||||
|
||||
fn submit_and_watch(
|
||||
&self,
|
||||
_at: &BlockId<Self::Block>,
|
||||
_at: Self::Hash,
|
||||
_source: TransactionSource,
|
||||
_xt: TransactionFor<Self>,
|
||||
) -> PoolFuture<Pin<Box<TransactionStatusStreamFor<Self>>>, Self::Error> {
|
||||
|
||||
@@ -27,7 +27,6 @@ use node_testing::bench::{BenchDb, BlockType, DatabaseType, KeyTypes};
|
||||
|
||||
use sc_transaction_pool::BasicPool;
|
||||
use sc_transaction_pool_api::{TransactionPool, TransactionSource};
|
||||
use sp_runtime::generic::BlockId;
|
||||
|
||||
use crate::core::{self, Mode, Path};
|
||||
|
||||
@@ -58,10 +57,11 @@ impl core::BenchmarkDescription for PoolBenchmarkDescription {
|
||||
impl core::Benchmark for PoolBenchmark {
|
||||
fn run(&mut self, mode: Mode) -> std::time::Duration {
|
||||
let context = self.database.create_context();
|
||||
let genesis_hash = context.client.chain_info().genesis_hash;
|
||||
|
||||
let _ = context
|
||||
.client
|
||||
.runtime_version_at(context.client.chain_info().genesis_hash)
|
||||
.runtime_version_at(genesis_hash)
|
||||
.expect("Failed to get runtime version")
|
||||
.spec_version;
|
||||
|
||||
@@ -90,7 +90,7 @@ impl core::Benchmark for PoolBenchmark {
|
||||
let start = std::time::Instant::now();
|
||||
let submissions = generated_transactions
|
||||
.into_iter()
|
||||
.map(|tx| txpool.submit_one(&BlockId::Number(0), TransactionSource::External, tx));
|
||||
.map(|tx| txpool.submit_one(genesis_hash, TransactionSource::External, tx));
|
||||
futures::executor::block_on(futures::future::join_all(submissions));
|
||||
let elapsed = start.elapsed();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user