diff --git a/Cargo.lock b/Cargo.lock index 0127cab22a6..d2f0d4dd723 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -737,7 +737,7 @@ dependencies = [ [[package]] name = "hyper" version = "0.9.4" -source = "git+https://github.com/ethcore/hyper#9e346c1d4bc30cd4142dea9d8a0b117d30858ca4" +source = "git+https://github.com/ethcore/hyper#4379a3629abc10e42e6d3fbcb21ecef5c1c86a77" dependencies = [ "cookie 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 5910d03099c..68fb4048384 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -140,7 +140,7 @@ pub trait BlockProvider { fn blocks_with_bloom(&self, bloom: &H2048, from_block: BlockNumber, to_block: BlockNumber) -> Vec; /// Returns logs matching given filter. - fn logs(&self, mut blocks: Vec, matches: F, limit: Option) -> Vec + fn logs(&self, blocks: Vec, matches: F, limit: Option) -> Vec where F: Fn(&LogEntry) -> bool, Self: Sized; } diff --git a/sync/src/chain.rs b/sync/src/chain.rs index c92aa4aaa0c..f87c3b10415 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -1995,9 +1995,6 @@ impl ChainSync { trace!(target: "sync", "Bad blocks in the queue, restarting"); self.restart(io); } - for peer_info in self.peers.values_mut() { - peer_info.last_sent_transactions.clear(); - } } } @@ -2334,7 +2331,7 @@ mod tests { } #[test] - fn propagates_transactions_again_after_new_block() { + fn should_not_propagate_transactions_again_after_new_block() { let mut client = TestBlockChainClient::new(); client.add_blocks(100, EachBlockWith::Uncle); client.insert_transaction_to_queue(); @@ -2347,14 +2344,13 @@ mod tests { // Try to propagate same transactions for the second time let peer_count2 = sync.propagate_new_transactions(&mut io); - // 2 message should be send - assert_eq!(2, io.queue.len()); - // 1 peer should be updated twice + // 1 message should be send + assert_eq!(1, io.queue.len()); + // 1 peer should be updated only for the first time assert_eq!(1, peer_count); - assert_eq!(1, peer_count2); + assert_eq!(0, peer_count2); // TRANSACTIONS_PACKET assert_eq!(0x02, io.queue[0].packet_id); - assert_eq!(0x02, io.queue[1].packet_id); } #[test]