mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Cleanup compact block logging (#2126)
* cleanup logging, error logging around compact blocks * rustfmt
This commit is contained in:
parent
2d4538c428
commit
16641fe149
4 changed files with 9 additions and 14 deletions
|
@ -90,7 +90,7 @@ pub fn process_block(b: &Block, ctx: &mut BlockContext<'_>) -> Result<Option<Tip
|
||||||
// spend resources reading the full block when its header is invalid
|
// spend resources reading the full block when its header is invalid
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"pipe: process_block {} at {}, in/out/kern: {}/{}/{}",
|
"pipe: process_block {} at {} [in/out/kern: {}/{}/{}]",
|
||||||
b.hash(),
|
b.hash(),
|
||||||
b.header.height,
|
b.header.height,
|
||||||
b.inputs().len(),
|
b.inputs().len(),
|
||||||
|
|
|
@ -226,7 +226,7 @@ impl Pool {
|
||||||
self.validate_raw_tx(&agg_tx, header)?;
|
self.validate_raw_tx(&agg_tx, header)?;
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"add_to_pool [{}]: {} ({}), in/out/kern: {}/{}/{}, pool: {} (at block {})",
|
"add_to_pool [{}]: {} ({}) [in/out/kern: {}/{}/{}] pool: {} (at block {})",
|
||||||
self.name,
|
self.name,
|
||||||
entry.tx.hash(),
|
entry.tx.hash(),
|
||||||
entry.src.debug_name,
|
entry.src.debug_name,
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
let header = self.chain().head_header().unwrap();
|
let header = self.chain().head_header().unwrap();
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"Received tx {}, inputs: {}, outputs: {}, kernels: {}, going to process.",
|
"Received tx {}, [in/out/kern: {}/{}/{}] going to process.",
|
||||||
tx_hash,
|
tx_hash,
|
||||||
tx.inputs().len(),
|
tx.inputs().len(),
|
||||||
tx.outputs().len(),
|
tx.outputs().len(),
|
||||||
|
@ -109,7 +109,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
|
|
||||||
fn block_received(&self, b: core::Block, addr: SocketAddr) -> bool {
|
fn block_received(&self, b: core::Block, addr: SocketAddr) -> bool {
|
||||||
debug!(
|
debug!(
|
||||||
"Received block {} at {} from {}, inputs: {}, outputs: {}, kernels: {}, going to process.",
|
"Received block {} at {} from {} [in/out/kern: {}/{}/{}] going to process.",
|
||||||
b.hash(),
|
b.hash(),
|
||||||
b.header.height,
|
b.header.height,
|
||||||
addr,
|
addr,
|
||||||
|
@ -123,7 +123,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
fn compact_block_received(&self, cb: core::CompactBlock, addr: SocketAddr) -> bool {
|
fn compact_block_received(&self, cb: core::CompactBlock, addr: SocketAddr) -> bool {
|
||||||
let bhash = cb.hash();
|
let bhash = cb.hash();
|
||||||
debug!(
|
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,
|
bhash,
|
||||||
cb.header.height,
|
cb.header.height,
|
||||||
addr,
|
addr,
|
||||||
|
@ -138,7 +138,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
match core::Block::hydrate_from(cb, vec![]) {
|
match core::Block::hydrate_from(cb, vec![]) {
|
||||||
Ok(block) => self.process_block(block, addr),
|
Ok(block) => self.process_block(block, addr),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Invalid hydrated block {}: {}", cb_hash, e);
|
debug!("Invalid hydrated block {}: {:?}", cb_hash, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
.chain()
|
.chain()
|
||||||
.process_block_header(&cb.header, self.chain_opts())
|
.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();
|
return !e.is_bad_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
let block = match core::Block::hydrate_from(cb.clone(), txs) {
|
let block = match core::Block::hydrate_from(cb.clone(), txs) {
|
||||||
Ok(block) => block,
|
Ok(block) => block,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Invalid hydrated block {}: {}", cb.hash(), e);
|
debug!("Invalid hydrated block {}: {:?}", cb.hash(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -232,11 +232,7 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn headers_received(&self, bhs: &[core::BlockHeader], addr: SocketAddr) -> bool {
|
fn headers_received(&self, bhs: &[core::BlockHeader], addr: SocketAddr) -> bool {
|
||||||
info!(
|
info!("Received {} block headers from {}", bhs.len(), addr,);
|
||||||
"Received block headers {:?} from {}",
|
|
||||||
bhs.iter().map(|x| x.hash()).collect::<Vec<_>>(),
|
|
||||||
addr,
|
|
||||||
);
|
|
||||||
|
|
||||||
if bhs.len() == 0 {
|
if bhs.len() == 0 {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
//! as a facade.
|
//! as a facade.
|
||||||
|
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{thread, time};
|
use std::{thread, time};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue