mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 23:31:07 +00:00
Prepare for asynchronous transaction validation in tx pool (#3650)
* async txpool API * Update core/rpc/src/author/mod.rs Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update core/transaction-pool/graph/src/pool.rs Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Pool -> Pool + ValidatedPool * removed lost block_on when importing xt from network * fix grumbles * alias for future::Executor in rpc * removed executor from Author RPCs * Pool + SharedValidatedPool -> Pool * fix compilation after merge * another fix * another fix
This commit is contained in:
committed by
GitHub
parent
facf31f77e
commit
387c31598d
@@ -40,7 +40,6 @@ use sr_primitives::traits::Block as BlockT;
|
||||
use node_executor::NativeExecutor;
|
||||
use network::NetworkService;
|
||||
use offchain::OffchainWorkers;
|
||||
use transaction_pool::ChainApi;
|
||||
use primitives::Blake2Hasher;
|
||||
|
||||
construct_simple_protocol! {
|
||||
@@ -65,7 +64,7 @@ macro_rules! new_full_start {
|
||||
Ok(client::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client|
|
||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::ChainApi::new(client)))
|
||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::FullChainApi::new(client)))
|
||||
)?
|
||||
.with_import_queue(|_config, client, mut select_chain, _transaction_pool| {
|
||||
let select_chain = select_chain.take()
|
||||
@@ -251,7 +250,7 @@ pub fn new_full<C: Send + Default + 'static>(config: NodeConfiguration<C>)
|
||||
LongestChain<ConcreteBackend, ConcreteBlock>,
|
||||
NetworkStatus<ConcreteBlock>,
|
||||
NetworkService<ConcreteBlock, crate::service::NodeProtocol, <ConcreteBlock as BlockT>::Hash>,
|
||||
TransactionPool<ChainApi<ConcreteClient, ConcreteBlock>>,
|
||||
TransactionPool<transaction_pool::FullChainApi<ConcreteClient, ConcreteBlock>>,
|
||||
OffchainWorkers<
|
||||
ConcreteClient,
|
||||
<ConcreteBackend as client::backend::Backend<Block, Blake2Hasher>>::OffchainStorage,
|
||||
@@ -275,7 +274,7 @@ pub fn new_light<C: Send + Default + 'static>(config: NodeConfiguration<C>)
|
||||
Ok(LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client|
|
||||
Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client)))
|
||||
Ok(TransactionPool::new(config, transaction_pool::FullChainApi::new(client)))
|
||||
)?
|
||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
||||
let fetch_checker = fetcher
|
||||
|
||||
@@ -24,3 +24,4 @@ transaction_pool = { package = "substrate-transaction-pool", path = "../../core/
|
||||
node-testing = { path = "../testing" }
|
||||
node-runtime = { path = "../runtime" }
|
||||
env_logger = "0.6"
|
||||
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.18" }
|
||||
|
||||
@@ -111,6 +111,7 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use futures03::executor::block_on;
|
||||
use node_runtime::{CheckedExtrinsic, Call, TimestampCall};
|
||||
use codec::Decode;
|
||||
use node_testing::{
|
||||
@@ -125,7 +126,7 @@ mod tests {
|
||||
// given
|
||||
let _ = env_logger::try_init();
|
||||
let client = Arc::new(TestClientBuilder::new().build());
|
||||
let pool = Arc::new(Pool::new(Default::default(), transaction_pool::ChainApi::new(client.clone())));
|
||||
let pool = Arc::new(Pool::new(Default::default(), transaction_pool::FullChainApi::new(client.clone())));
|
||||
|
||||
let new_transaction = |extra| {
|
||||
let ex = CheckedExtrinsic {
|
||||
@@ -139,9 +140,9 @@ mod tests {
|
||||
};
|
||||
// Populate the pool
|
||||
let ext0 = new_transaction(signed_extra(0, 0));
|
||||
pool.submit_one(&BlockId::number(0), ext0).unwrap();
|
||||
block_on(pool.submit_one(&BlockId::number(0), ext0)).unwrap();
|
||||
let ext1 = new_transaction(signed_extra(1, 0));
|
||||
pool.submit_one(&BlockId::number(0), ext1).unwrap();
|
||||
block_on(pool.submit_one(&BlockId::number(0), ext1)).unwrap();
|
||||
|
||||
let accounts = Accounts::new(client, pool);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user