mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
don't use delays in tests (#5404)
This commit is contained in:
@@ -31,7 +31,7 @@ pub use sc_transaction_graph as txpool;
|
||||
pub use crate::api::{FullChainApi, LightChainApi};
|
||||
|
||||
use std::{collections::HashMap, sync::Arc, pin::Pin};
|
||||
use futures::{Future, FutureExt, future::ready, channel::oneshot};
|
||||
use futures::{prelude::*, future::ready, channel::oneshot};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use sp_runtime::{
|
||||
@@ -151,6 +151,27 @@ impl<PoolApi, Block> BasicPool<PoolApi, Block>
|
||||
Self::with_revalidation_type(options, pool_api, RevalidationType::Full)
|
||||
}
|
||||
|
||||
/// Create new basic transaction pool with provided api, for tests.
|
||||
#[cfg(test)]
|
||||
pub fn new_test(
|
||||
pool_api: Arc<PoolApi>,
|
||||
) -> (Self, Pin<Box<dyn Future<Output=()> + Send>>, intervalier::BackSignalControl) {
|
||||
let pool = Arc::new(sc_transaction_graph::Pool::new(Default::default(), pool_api.clone()));
|
||||
let (revalidation_queue, background_task, notifier) =
|
||||
revalidation::RevalidationQueue::new_test(pool_api.clone(), pool.clone());
|
||||
(
|
||||
BasicPool {
|
||||
api: pool_api,
|
||||
pool,
|
||||
revalidation_queue: Arc::new(revalidation_queue),
|
||||
revalidation_strategy: Arc::new(Mutex::new(RevalidationStrategy::Always)),
|
||||
ready_poll: Default::default(),
|
||||
},
|
||||
background_task,
|
||||
notifier,
|
||||
)
|
||||
}
|
||||
|
||||
/// Create new basic transaction pool with provided api and custom
|
||||
/// revalidation type.
|
||||
pub fn with_revalidation_type(
|
||||
|
||||
Reference in New Issue
Block a user