mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Recover transaction pool on light client (#3833)
* recover tx pool on light client * revert local tests fix * removed import renamings * futures03::Future -> std::future::Future * Update core/transaction-pool/graph/src/error.rs Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * replace remove_from_ready with remove_invalid * avoid excess hashing * debug -> warn * TransactionPool + BasicTransactionPool * pause future tx reject when resubmitting * bump impl_version to make CI happy * and revert back local test fixes * alter doc to restart CI * Transaction::clone() -> Transaction::duplicate() * transactions -> updated_tranasctions * remove explicit consensus-common ref * ::std:: -> std:: * manual set/unset flag -> calling clusore with given flag value * removed comments * removed force argument * BestIterator -> Box<Iterator> * separate crate for TxPool + Maintainer trait * long line fix * pos-merge fix * fix benches compilation * Rename txpoolapi to txpool_api * Clean up. * Finalize merge. * post-merge fix * Move transaction pool api to primitives directly. * Consistent naming for txpool-runtime-api * Warn about missing docs. * Move abstraction for offchain calls to tx-pool-api. * Merge RPC instantiation. * Update cargo.lock * Post merge fixes. * Avoid depending on client. * Fix build
This commit is contained in:
committed by
Gavin Wood
parent
3e26fceda4
commit
a782021ee8
@@ -24,7 +24,8 @@ primitives = { package = "substrate-primitives", path = "../../primitives/core"
|
||||
substrate-executor = { path = "../../client/executor" }
|
||||
substrate-service = { path = "../../client/service" }
|
||||
inherents = { package = "substrate-inherents", path = "../../primitives/inherents" }
|
||||
transaction-pool = { package = "sc-transaction-pool", path = "../../client/transaction-pool" }
|
||||
txpool = { package = "sc-transaction-pool", path = "../../client/transaction-pool" }
|
||||
txpool-api = { package = "sp-transaction-pool-api", path = "../../primitives/transaction-pool" }
|
||||
network = { package = "substrate-network", path = "../../client/network" }
|
||||
aura = { package = "substrate-consensus-aura", path = "../../client/consensus/aura" }
|
||||
aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../primitives/consensus/aura" }
|
||||
|
||||
@@ -29,7 +29,7 @@ support = { package = "frame-support", path = "../../../frame/support", default-
|
||||
system = { package = "frame-system", path = "../../../frame/system", default-features = false }
|
||||
timestamp = { package = "pallet-timestamp", path = "../../../frame/timestamp", default-features = false }
|
||||
transaction-payment = { package = "pallet-transaction-payment", path = "../../../frame/transaction-payment", default-features = false }
|
||||
tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false }
|
||||
txpool-runtime-api = { package = "sp-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false }
|
||||
version = { package = "sr-version", path = "../../../primitives/sr-version", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
@@ -62,6 +62,6 @@ std = [
|
||||
"system/std",
|
||||
"timestamp/std",
|
||||
"transaction-payment/std",
|
||||
"tx-pool-api/std",
|
||||
"txpool-runtime-api/std",
|
||||
"version/std",
|
||||
]
|
||||
|
||||
@@ -328,7 +328,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl tx_pool_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
impl txpool_runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ use std::time::Duration;
|
||||
use substrate_client::LongestChain;
|
||||
use runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
||||
use substrate_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
|
||||
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
|
||||
use inherents::InherentDataProviders;
|
||||
use network::{construct_simple_protocol};
|
||||
use substrate_executor::native_executor_instance;
|
||||
@@ -41,9 +40,13 @@ macro_rules! new_full_start {
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(substrate_client::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client|
|
||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::FullChainApi::new(client)))
|
||||
)?
|
||||
.with_transaction_pool(|config, client, _fetcher| {
|
||||
let pool_api = txpool::FullChainApi::new(client.clone());
|
||||
let pool = txpool::BasicPool::new(config, pool_api);
|
||||
let maintainer = txpool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||
Ok(maintainable_pool)
|
||||
})?
|
||||
.with_import_queue(|_config, client, mut select_chain, transaction_pool| {
|
||||
let select_chain = select_chain.take()
|
||||
.ok_or_else(|| substrate_service::Error::SelectChainRequired)?;
|
||||
@@ -191,9 +194,15 @@ pub fn new_light<C: Send + Default + 'static>(config: Configuration<C, GenesisCo
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client|
|
||||
Ok(TransactionPool::new(config, transaction_pool::FullChainApi::new(client)))
|
||||
)?
|
||||
.with_transaction_pool(|config, client, fetcher| {
|
||||
let fetcher = fetcher
|
||||
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
|
||||
let pool_api = txpool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||
let pool = txpool::BasicPool::new(config, pool_api);
|
||||
let maintainer = txpool::LightBasicPoolMaintainer::with_defaults(pool.pool().clone(), client, fetcher);
|
||||
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||
Ok(maintainable_pool)
|
||||
})?
|
||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
||||
let fetch_checker = fetcher
|
||||
.map(|fetcher| fetcher.checker().clone())
|
||||
|
||||
Reference in New Issue
Block a user