From 6f041108767a76d4ee964411bb8e346364444d47 Mon Sep 17 00:00:00 2001 From: Evan Chipman <42247026+evchip@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:25:27 +0700 Subject: [PATCH] chore: rename SenderId::into_id to SenderId::into_transaction_id (#11793) Co-authored-by: Matthias Seitz --- crates/transaction-pool/src/identifier.rs | 2 +- crates/transaction-pool/src/pool/mod.rs | 5 +++-- crates/transaction-pool/src/pool/txpool.rs | 12 ++++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/transaction-pool/src/identifier.rs b/crates/transaction-pool/src/identifier.rs index c50d39ae49..2e5312a210 100644 --- a/crates/transaction-pool/src/identifier.rs +++ b/crates/transaction-pool/src/identifier.rs @@ -61,7 +61,7 @@ impl SenderId { } /// Converts the sender to a [`TransactionId`] with the given nonce. - pub const fn into_id(self, nonce: u64) -> TransactionId { + pub const fn into_transaction_id(self, nonce: u64) -> TransactionId { TransactionId::new(self, nonce) } } diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 64e6dad679..600a8da934 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -792,8 +792,9 @@ where on_chain_nonce: u64, ) -> Option>> { let sender_id = self.get_sender_id(sender); - self.get_pool_data() - .get_highest_consecutive_transaction_by_sender(sender_id.into_id(on_chain_nonce)) + self.get_pool_data().get_highest_consecutive_transaction_by_sender( + sender_id.into_transaction_id(on_chain_nonce), + ) } /// Returns all transactions that where submitted with the given [`TransactionOrigin`] diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index c89aca830f..9d284392db 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -2804,20 +2804,24 @@ mod tests { // Get last consecutive transaction let sender_id = f.ids.sender_id(&sender).unwrap(); - let next_tx = pool.get_highest_consecutive_transaction_by_sender(sender_id.into_id(0)); + let next_tx = + pool.get_highest_consecutive_transaction_by_sender(sender_id.into_transaction_id(0)); assert_eq!(next_tx.map(|tx| tx.nonce()), Some(2), "Expected nonce 2 for on-chain nonce 0"); - let next_tx = pool.get_highest_consecutive_transaction_by_sender(sender_id.into_id(4)); + let next_tx = + pool.get_highest_consecutive_transaction_by_sender(sender_id.into_transaction_id(4)); assert_eq!(next_tx.map(|tx| tx.nonce()), Some(5), "Expected nonce 5 for on-chain nonce 4"); - let next_tx = pool.get_highest_consecutive_transaction_by_sender(sender_id.into_id(5)); + let next_tx = + pool.get_highest_consecutive_transaction_by_sender(sender_id.into_transaction_id(5)); assert_eq!(next_tx.map(|tx| tx.nonce()), Some(5), "Expected nonce 5 for on-chain nonce 5"); // update the tracked nonce let mut info = SenderInfo::default(); info.update(8, U256::ZERO); pool.sender_info.insert(sender_id, info); - let next_tx = pool.get_highest_consecutive_transaction_by_sender(sender_id.into_id(5)); + let next_tx = + pool.get_highest_consecutive_transaction_by_sender(sender_id.into_transaction_id(5)); assert_eq!(next_tx.map(|tx| tx.nonce()), Some(9), "Expected nonce 9 for on-chain nonce 8"); }