Remove flushlns and tidy ready for primetime.

This commit is contained in:
Gav Wood 2016-01-27 16:13:21 +01:00
parent d4c76eed0f
commit 0cd2e85569
3 changed files with 1 additions and 11 deletions

View File

@ -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))

View File

@ -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;

View File

@ -33,11 +33,8 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
{
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;