Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions substrate/bin/node/bench/src/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
3 changes: 3 additions & 0 deletions substrate/client/transaction-pool/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be tempted to call this future_transactions to avoid any confusion with rust futures.


/// Returns pool status.
fn status(&self) -> PoolStatus;

Expand Down
3 changes: 1 addition & 2 deletions substrate/client/transaction-pool/src/graph/base_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
}
Expand Down
6 changes: 6 additions & 0 deletions substrate/client/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down