perf: use BTreeMap::pop_last (#2994)

This commit is contained in:
Matthias Seitz
2023-06-05 19:43:23 +02:00
committed by GitHub
parent d2c68edf23
commit 18b70f17f7

View File

@ -49,8 +49,7 @@ impl<T: TransactionOrdering> Iterator for BestTransactions<T> {
fn next(&mut self) -> Option<Self::Item> {
loop {
// Remove the next independent tx with the highest priority
let best = self.independent.iter().next_back()?.clone();
let best = self.independent.take(&best)?;
let best = self.independent.pop_last()?;
let hash = best.transaction.hash();
// skip transactions that were marked as invalid