mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-03 11:34:57 -05:00
feat: add getters for tx by origin (#5516)
This commit is contained in:
@@ -473,6 +473,13 @@ where
|
||||
self.pool.get_transactions_by_sender(sender)
|
||||
}
|
||||
|
||||
fn get_transactions_by_origin(
|
||||
&self,
|
||||
origin: TransactionOrigin,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.pool.get_transactions_by_origin(origin)
|
||||
}
|
||||
|
||||
fn unique_senders(&self) -> HashSet<Address> {
|
||||
self.pool.unique_senders()
|
||||
}
|
||||
|
||||
@@ -216,6 +216,13 @@ impl TransactionPool for NoopTransactionPool {
|
||||
}
|
||||
Err(BlobStoreError::MissingSidecar(tx_hashes[0]))
|
||||
}
|
||||
|
||||
fn get_transactions_by_origin(
|
||||
&self,
|
||||
_origin: TransactionOrigin,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
/// A [`TransactionValidator`] that does nothing.
|
||||
|
||||
@@ -695,6 +695,14 @@ where
|
||||
self.pool.read().get_transactions_by_sender(sender_id)
|
||||
}
|
||||
|
||||
/// Returns all transactions that where submitted with the given [TransactionOrigin]
|
||||
pub(crate) fn get_transactions_by_origin(
|
||||
&self,
|
||||
origin: TransactionOrigin,
|
||||
) -> Vec<Arc<ValidPoolTransaction<T::Transaction>>> {
|
||||
self.pool.read().all().transactions_iter().filter(|tx| tx.origin == origin).collect()
|
||||
}
|
||||
|
||||
/// Returns all the transactions belonging to the hashes.
|
||||
///
|
||||
/// If no transaction exists, it is skipped.
|
||||
|
||||
@@ -306,6 +306,27 @@ pub trait TransactionPool: Send + Sync + Clone {
|
||||
sender: Address,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||
|
||||
/// Returns all transactions that where submitted with the given [TransactionOrigin]
|
||||
fn get_transactions_by_origin(
|
||||
&self,
|
||||
origin: TransactionOrigin,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||
|
||||
/// Returns all transactions that where submitted as [TransactionOrigin::Local]
|
||||
fn get_local_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.get_transactions_by_origin(TransactionOrigin::Local)
|
||||
}
|
||||
|
||||
/// Returns all transactions that where submitted as [TransactionOrigin::Private]
|
||||
fn get_private_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.get_transactions_by_origin(TransactionOrigin::Private)
|
||||
}
|
||||
|
||||
/// Returns all transactions that where submitted as [TransactionOrigin::External]
|
||||
fn get_external_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.get_transactions_by_origin(TransactionOrigin::External)
|
||||
}
|
||||
|
||||
/// Returns a set of all senders of transactions in the pool
|
||||
fn unique_senders(&self) -> HashSet<Address>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user