mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rename SenderId::into_id to SenderId::into_transaction_id (#11793)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,8 +792,9 @@ where
|
||||
on_chain_nonce: u64,
|
||||
) -> Option<Arc<ValidPoolTransaction<T::Transaction>>> {
|
||||
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`]
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user