From 548d7f16364b988e8b36fbcfa62bb717e9e8da5f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 7 Sep 2023 14:20:40 +0200 Subject: [PATCH] chore: add is_empty check before read lock (#4507) --- crates/transaction-pool/src/pool/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 9eb741a6a9..0b53af5658 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -660,6 +660,9 @@ where /// Removes all transactions that are present in the pool. pub(crate) fn retain_unknown(&self, hashes: &mut Vec) { + if hashes.is_empty() { + return + } let pool = self.pool.read(); hashes.retain(|tx| !pool.contains(tx)) }