From 6fd9780e602e6902896bebc0d9f88368b549ff85 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 26 May 2016 12:44:17 +0200 Subject: [PATCH] do not clone pending transaction hashes --- rpc/src/v1/impls/eth.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index fc22d2256..a13512357 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -674,14 +674,18 @@ impl EthFilter for EthFilterClient where PollFilter::PendingTransaction(ref mut previous_hashes) => { // get hashes of pending transactions let current_hashes = take_weak!(self.miner).pending_transactions_hashes(); - let previous_hashes_set = previous_hashes.into_iter().map(|h| h.clone()).collect::>(); - // find all new hashes - let new_hashes = current_hashes - .iter() - .filter(|hash| !previous_hashes_set.contains(&hash)) - .cloned() - .collect::>(); + let new_hashes = + { + let previous_hashes_set = previous_hashes.iter().collect::>(); + + // find all new hashes + current_hashes + .iter() + .filter(|hash| !previous_hashes_set.contains(hash)) + .cloned() + .collect::>() + }; // save all hashes of pending transactions *previous_hashes = current_hashes;