From 885c2d73eacb4f11ea295b916de7d011b42b101f Mon Sep 17 00:00:00 2001 From: Simon B Date: Thu, 18 Jan 2018 23:47:42 +0100 Subject: [PATCH] Making initial sync easier on the eyes [master] (#623) * Making initial sync easier on the eyes: - display "chain pointers" as: cumulative @ height [hash] - clarify and line up to make the "pointers" easy to compare - make every 100th block show info on debug level info, else as before --- chain/src/pipe.rs | 53 ++++++++++++++++++-------------------------- grin/src/miner.rs | 6 ++--- p2p/src/handshake.rs | 9 +++++++- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index aaeb427fb..e19bcc194 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -175,12 +175,14 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext) -> Result<(), E } if !ctx.opts.intersects(SKIP_POW) { - let cycle_size = global::sizeshift(); - - debug!(LOGGER, "pipe: validate_header cuckoo size {}", cycle_size); - if !(ctx.pow_verifier)(header, cycle_size as u32) { + let n = global::sizeshift() as u32; + if !(ctx.pow_verifier)(header, n) { + error!(LOGGER, "pipe: validate_header failed for cuckoo shift size {}", n); return Err(Error::InvalidPow); } + if header.height % 500 == 0 { + debug!(LOGGER, "Validating header validated, using cuckoo shift size {}", n); + } } // first I/O cost, better as late as possible @@ -333,16 +335,12 @@ fn update_head(b: &Block, ctx: &mut BlockContext) -> Result, Error> .map_err(|e| Error::StoreErr(e, "pipe save head".to_owned()))?; } ctx.head = tip.clone(); - debug!( - LOGGER, - "pipe: update_head: {}, {} at {}", - b.hash(), - b.header.total_difficulty, - b.header.height - ); - if b.header.height % 500 == 0 { + if b.header.height % 100 == 0 { info!(LOGGER, "pipe: chain head reached {} @ {} [{}]", b.header.height, b.header.difficulty, b.hash()); + } else { + debug!(LOGGER, "pipe: chain head reached {} @ {} [{}]", + b.header.height, b.header.difficulty, b.hash()); } Ok(Some(tip)) } else { @@ -357,15 +355,10 @@ fn update_sync_head(bh: &BlockHeader, ctx: &mut BlockContext) -> Result Result