From 16641fe149dd7716c79d03a54d6a4e07a5c62373 Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Tue, 11 Dec 2018 14:11:58 +0000 Subject: [PATCH] Cleanup compact block logging (#2126) * cleanup logging, error logging around compact blocks * rustfmt --- chain/src/pipe.rs | 2 +- pool/src/pool.rs | 2 +- servers/src/common/adapters.rs | 18 +++++++----------- servers/src/grin/server.rs | 1 - 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index 1bc599bdf..3f949869c 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -90,7 +90,7 @@ pub fn process_block(b: &Block, ctx: &mut BlockContext<'_>) -> Result bool { debug!( - "Received block {} at {} from {}, inputs: {}, outputs: {}, kernels: {}, going to process.", + "Received block {} at {} from {} [in/out/kern: {}/{}/{}] going to process.", b.hash(), b.header.height, addr, @@ -123,7 +123,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { fn compact_block_received(&self, cb: core::CompactBlock, addr: SocketAddr) -> bool { let bhash = cb.hash(); debug!( - "Received compact_block {} at {} from {}, outputs: {}, kernels: {}, kern_ids: {}, going to process.", + "Received compact_block {} at {} from {} [out/kern/kern_ids: {}/{}/{}] going to process.", bhash, cb.header.height, addr, @@ -138,7 +138,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { match core::Block::hydrate_from(cb, vec![]) { Ok(block) => self.process_block(block, addr), Err(e) => { - debug!("Invalid hydrated block {}: {}", cb_hash, e); + debug!("Invalid hydrated block {}: {:?}", cb_hash, e); return false; } } @@ -148,7 +148,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { .chain() .process_block_header(&cb.header, self.chain_opts()) { - debug!("Invalid compact block header {}: {}", cb_hash, e); + debug!("Invalid compact block header {}: {:?}", cb_hash, e.kind()); return !e.is_bad_data(); } @@ -172,7 +172,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { let block = match core::Block::hydrate_from(cb.clone(), txs) { Ok(block) => block, Err(e) => { - debug!("Invalid hydrated block {}: {}", cb.hash(), e); + debug!("Invalid hydrated block {}: {:?}", cb.hash(), e); return false; } }; @@ -232,11 +232,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { } fn headers_received(&self, bhs: &[core::BlockHeader], addr: SocketAddr) -> bool { - info!( - "Received block headers {:?} from {}", - bhs.iter().map(|x| x.hash()).collect::>(), - addr, - ); + info!("Received {} block headers from {}", bhs.len(), addr,); if bhs.len() == 0 { return false; diff --git a/servers/src/grin/server.rs b/servers/src/grin/server.rs index df798633a..976933a6c 100644 --- a/servers/src/grin/server.rs +++ b/servers/src/grin/server.rs @@ -17,7 +17,6 @@ //! as a facade. use std::net::SocketAddr; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::{thread, time};