From 0cd2e855698ada995467b48767a2462e521dafa5 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 27 Jan 2016 16:13:21 +0100 Subject: [PATCH] Remove flushlns and tidy ready for primetime. --- src/block_queue.rs | 2 -- src/client.rs | 5 ----- src/tests/chain.rs | 5 +---- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/block_queue.rs b/src/block_queue.rs index dab3a5fe3..5ce649710 100644 --- a/src/block_queue.rs +++ b/src/block_queue.rs @@ -158,7 +158,6 @@ impl BlockQueue { }, Err(err) => { let mut v = verification.lock().unwrap(); - flushln!("Stage 2 block verification failed for {}\nError: {:?}", block_hash, err); warn!(target: "client", "Stage 2 block verification failed for {}\nError: {:?}", block_hash, err); v.bad.insert(block_hash.clone()); v.verifying.retain(|e| e.hash != block_hash); @@ -224,7 +223,6 @@ impl BlockQueue { Ok(h) }, Err(err) => { - flushln!("Stage 1 block verification failed for {}\nError: {:?}", BlockView::new(&bytes).header_view().sha3(), err); warn!(target: "client", "Stage 1 block verification failed for {}\nError: {:?}", BlockView::new(&bytes).header_view().sha3(), err); self.verification.lock().unwrap().bad.insert(h.clone()); Err(From::from(err)) diff --git a/src/client.rs b/src/client.rs index 8aea437e4..33ba19147 100644 --- a/src/client.rs +++ b/src/client.rs @@ -199,7 +199,6 @@ impl Client { let _import_lock = self.import_lock.lock(); let blocks = self.block_queue.write().unwrap().drain(128); for block in blocks { -// flushln!("Importing {}...", block.header.hash()); if bad.contains(&block.header.parent_hash) { self.block_queue.write().unwrap().mark_as_bad(&block.header.hash()); bad.insert(block.header.hash()); @@ -208,7 +207,6 @@ impl Client { let header = &block.header; if let Err(e) = verify_block_family(&header, &block.bytes, self.engine.deref().deref(), self.chain.read().unwrap().deref()) { - flushln!("Stage 3 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); warn!(target: "client", "Stage 3 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); self.block_queue.write().unwrap().mark_as_bad(&header.hash()); bad.insert(block.header.hash()); @@ -217,7 +215,6 @@ impl Client { let parent = match self.chain.read().unwrap().block_header(&header.parent_hash) { Some(p) => p, None => { - flushln!("Block import failed for #{} ({}): Parent not found ({}) ", header.number(), header.hash(), header.parent_hash); warn!(target: "client", "Block import failed for #{} ({}): Parent not found ({}) ", header.number(), header.hash(), header.parent_hash); self.block_queue.write().unwrap().mark_as_bad(&header.hash()); bad.insert(block.header.hash()); @@ -241,7 +238,6 @@ impl Client { let result = match enact_verified(&block, self.engine.deref().deref(), db, &parent, &last_hashes) { Ok(b) => b, Err(e) => { - flushln!("Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); bad.insert(block.header.hash()); self.block_queue.write().unwrap().mark_as_bad(&header.hash()); @@ -249,7 +245,6 @@ impl Client { } }; if let Err(e) = verify_block_final(&header, result.block().header()) { - flushln!("Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); self.block_queue.write().unwrap().mark_as_bad(&header.hash()); break; diff --git a/src/tests/chain.rs b/src/tests/chain.rs index babd2a42f..42b4ee78a 100644 --- a/src/tests/chain.rs +++ b/src/tests/chain.rs @@ -33,11 +33,8 @@ fn do_json_test(json_data: &[u8]) -> Vec { { let client = Client::new(spec, &dir, IoChannel::disconnected()).unwrap(); for (b, is_valid) in blocks.into_iter() { - let mut hash = H256::new(); if Block::is_good(&b) { - if let Ok(h) = client.import_block(b.clone()) { - hash = h; - } + let _ = client.import_block(b.clone()); } client.flush_queue(); let imported_ok = client.import_verified_blocks(&IoChannel::disconnected()) > 0;