File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
crates/transaction-pool/src Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ impl SenderId {
6666 std:: ops:: Bound :: Included ( TransactionId :: new ( self , 0 ) )
6767 }
6868
69+ /// Returns a `Range` for [`TransactionId`] starting with nonce `0` and ending with nonce
70+ /// `u64::MAX`
71+ pub const fn range ( self ) -> std:: ops:: RangeInclusive < TransactionId > {
72+ TransactionId :: new ( self , 0 ) ..=TransactionId :: new ( self , u64:: MAX )
73+ }
74+
6975 /// Converts the sender to a [`TransactionId`] with the given nonce.
7076 pub const fn into_transaction_id ( self , nonce : u64 ) -> TransactionId {
7177 TransactionId :: new ( self , nonce)
Original file line number Diff line number Diff line change @@ -186,11 +186,11 @@ impl<T: ParkedOrd> ParkedPool<T> {
186186 {
187187 // NOTE: This will not panic due to `!last_sender_transaction.is_empty()`
188188 let sender_id = self . last_sender_submission . last ( ) . unwrap ( ) . sender_id ;
189- let list = self . get_txs_by_sender ( sender_id) ;
190189
191190 // Drop transactions from this sender until the pool is under limits
192- for txid in list. into_iter ( ) . rev ( ) {
193- if let Some ( tx) = self . remove_transaction ( & txid) {
191+ while let Some ( ( tx_id, _) ) = self . by_id . range ( sender_id. range ( ) ) . next_back ( ) {
192+ let tx_id = * tx_id;
193+ if let Some ( tx) = self . remove_transaction ( & tx_id) {
194194 removed. push ( tx) ;
195195 }
196196
You can’t perform that action at this time.
0 commit comments