mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add get_highest_tx_by_sender to pools (#11514)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -489,6 +489,13 @@ where
|
||||
self.pool.get_transactions_by_sender(sender)
|
||||
}
|
||||
|
||||
fn get_highest_transaction_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.pool.get_highest_transaction_by_sender(sender)
|
||||
}
|
||||
|
||||
fn get_transaction_by_sender_and_nonce(
|
||||
&self,
|
||||
sender: Address,
|
||||
|
||||
@ -206,6 +206,13 @@ impl TransactionPool for NoopTransactionPool {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn get_highest_transaction_by_sender(
|
||||
&self,
|
||||
_sender: Address,
|
||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn get_transaction_by_sender_and_nonce(
|
||||
&self,
|
||||
_sender: Address,
|
||||
|
||||
@ -744,6 +744,15 @@ where
|
||||
self.get_pool_data().get_transactions_by_sender(sender_id)
|
||||
}
|
||||
|
||||
/// Returns the highest transaction of the address
|
||||
pub(crate) fn get_highest_transaction_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Option<Arc<ValidPoolTransaction<T::Transaction>>> {
|
||||
let sender_id = self.get_sender_id(sender);
|
||||
self.get_pool_data().get_highest_transaction_by_sender(sender_id)
|
||||
}
|
||||
|
||||
/// Returns all transactions that where submitted with the given [`TransactionOrigin`]
|
||||
pub(crate) fn get_transactions_by_origin(
|
||||
&self,
|
||||
|
||||
@ -334,6 +334,12 @@ pub trait TransactionPool: Send + Sync + Clone {
|
||||
sender: Address,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||
|
||||
/// Returns the highest transaction sent by a given user
|
||||
fn get_highest_transaction_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||
|
||||
/// Returns a transaction sent by a given user and a nonce
|
||||
fn get_transaction_by_sender_and_nonce(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user