chore: add is_empty check before read lock (#4507)

This commit is contained in:
Matthias Seitz
2023-09-07 14:20:40 +02:00
committed by GitHub
parent 41b4f46ae1
commit 548d7f1636

View File

@ -660,6 +660,9 @@ where
/// Removes all transactions that are present in the pool.
pub(crate) fn retain_unknown(&self, hashes: &mut Vec<TxHash>) {
if hashes.is_empty() {
return
}
let pool = self.pool.read();
hashes.retain(|tx| !pool.contains(tx))
}