From e93edfcdf0725ad2c9d59aa67e2712199474a50c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 4 Oct 2023 19:09:34 +0200 Subject: [PATCH] chore: return empty vec if input vec is empty (#4906) --- crates/transaction-pool/src/pool/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 44c8f1ee8..055064fa5 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -650,6 +650,9 @@ where &self, hashes: Vec, ) -> Vec>> { + if hashes.is_empty() { + return Vec::new() + } let removed = self.pool.write().remove_transactions(hashes); let mut listener = self.event_listener.write(); @@ -692,6 +695,9 @@ where &self, txs: Vec, ) -> Vec>> { + if txs.is_empty() { + return Vec::new() + } self.pool.read().get_all(txs).collect() }