mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Make transaction pool prune transactions only of canonical blocks (#6123)
* Make tx pool aware of retracted fork blocks * Make it compile * Update client/transaction-pool/src/lib.rs Co-authored-by: Nikolay Volf <nikvolf@gmail.com> * Fix doc test * Simplify the implementation * Send tree route as arc to prevent heavy clones * Switch to use `ExtrinsicHash` to make it more clear * Fix benchmark Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -34,14 +34,22 @@ macro_rules! new_full_start {
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
let builder = sc_service::ServiceBuilder::new_full::<
|
||||
node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor
|
||||
node_template_runtime::opaque::Block,
|
||||
node_template_runtime::RuntimeApi,
|
||||
crate::service::Executor
|
||||
>($config)?
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(sc_consensus::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client, _fetcher, prometheus_registry| {
|
||||
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry))
|
||||
.with_transaction_pool(|builder| {
|
||||
let pool_api = sc_transaction_pool::FullChainApi::new(
|
||||
builder.client().clone(),
|
||||
);
|
||||
Ok(sc_transaction_pool::BasicPool::new(
|
||||
builder.config().transaction_pool.clone(),
|
||||
std::sync::Arc::new(pool_api),
|
||||
builder.prometheus_registry(),
|
||||
))
|
||||
})?
|
||||
.with_import_queue(|
|
||||
_config,
|
||||
@@ -199,13 +207,19 @@ pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceE
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client, fetcher, prometheus_registry| {
|
||||
let fetcher = fetcher
|
||||
.with_transaction_pool(|builder| {
|
||||
let fetcher = builder.fetcher()
|
||||
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
|
||||
|
||||
let pool_api = sc_transaction_pool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||
let pool_api = sc_transaction_pool::LightChainApi::new(
|
||||
builder.client().clone(),
|
||||
fetcher.clone(),
|
||||
);
|
||||
let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
|
||||
config, Arc::new(pool_api), prometheus_registry, sc_transaction_pool::RevalidationType::Light,
|
||||
builder.config().transaction_pool.clone(),
|
||||
Arc::new(pool_api),
|
||||
builder.prometheus_registry(),
|
||||
sc_transaction_pool::RevalidationType::Light,
|
||||
);
|
||||
Ok(pool)
|
||||
})?
|
||||
|
||||
Reference in New Issue
Block a user