mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 06:21:11 +00:00
feat: add futures api to TransactionPool (#1348)
* feat: add futures api to `TransactionPool` * fix clippy
This commit is contained in:
@@ -282,6 +282,10 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
fn futures(&self) -> Vec<Self::InPoolTransaction> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn status(&self) -> PoolStatus {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
@@ -247,6 +247,9 @@ pub trait TransactionPool: Send + Sync {
|
||||
fn remove_invalid(&self, hashes: &[TxHash<Self>]) -> Vec<Arc<Self::InPoolTransaction>>;
|
||||
|
||||
// *** logging
|
||||
/// Get futures transaction list.
|
||||
fn futures(&self) -> Vec<Self::InPoolTransaction>;
|
||||
|
||||
/// Returns pool status.
|
||||
fn status(&self) -> PoolStatus;
|
||||
|
||||
|
||||
@@ -84,8 +84,7 @@ pub struct PruneStatus<Hash, Ex> {
|
||||
}
|
||||
|
||||
/// Immutable transaction
|
||||
#[cfg_attr(test, derive(Clone))]
|
||||
#[derive(PartialEq, Eq)]
|
||||
#[derive(PartialEq, Eq, Clone)]
|
||||
pub struct Transaction<Hash, Extrinsic> {
|
||||
/// Raw extrinsic representing that transaction.
|
||||
pub data: Extrinsic,
|
||||
|
||||
@@ -106,7 +106,7 @@ pub struct ValidatedPool<B: ChainApi> {
|
||||
is_validator: IsValidator,
|
||||
options: Options,
|
||||
listener: RwLock<Listener<ExtrinsicHash<B>, B>>,
|
||||
pool: RwLock<base::BasePool<ExtrinsicHash<B>, ExtrinsicFor<B>>>,
|
||||
pub(crate) pool: RwLock<base::BasePool<ExtrinsicHash<B>, ExtrinsicFor<B>>>,
|
||||
import_notification_sinks: Mutex<Vec<Sender<ExtrinsicHash<B>>>>,
|
||||
rotator: PoolRotator<ExtrinsicHash<B>>,
|
||||
}
|
||||
|
||||
@@ -358,6 +358,12 @@ where
|
||||
fn ready(&self) -> ReadyIteratorFor<PoolApi> {
|
||||
Box::new(self.pool.validated_pool().ready())
|
||||
}
|
||||
|
||||
fn futures(&self) -> Vec<Self::InPoolTransaction> {
|
||||
let pool = self.pool.validated_pool().pool.read();
|
||||
|
||||
pool.futures().cloned().collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block, Client> FullPool<Block, Client>
|
||||
|
||||
Reference in New Issue
Block a user