diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 4a4ee1643..fc22d2256 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -672,18 +672,22 @@ impl EthFilter for EthFilterClient where to_value(&hashes) }, PollFilter::PendingTransaction(ref mut previous_hashes) => { + // get hashes of pending transactions let current_hashes = take_weak!(self.miner).pending_transactions_hashes(); - // calculate diff let previous_hashes_set = previous_hashes.into_iter().map(|h| h.clone()).collect::>(); - let diff = current_hashes + + // find all new hashes + let new_hashes = current_hashes .iter() - .filter(|hash| previous_hashes_set.contains(&hash)) + .filter(|hash| !previous_hashes_set.contains(&hash)) .cloned() .collect::>(); + // save all hashes of pending transactions *previous_hashes = current_hashes; - to_value(&diff) + // return new hashes + to_value(&new_hashes) }, PollFilter::Logs(ref mut block_number, ref mut previous_logs, ref filter) => { // retrive the current block number