Quieten txhashset logging (#846)

* suppress the log msg until we start fast sync, we need to be past the horizon before we do this
This commit is contained in:
Antioch Peverell 2018-03-22 12:52:40 -04:00 committed by Ignotus Peverell
parent 675faec05d
commit 4b639cae5c

View file

@ -94,21 +94,22 @@ pub fn run_sync(
if current_time - prev_state_sync > time::Duration::seconds(5 * 60) { if current_time - prev_state_sync > time::Duration::seconds(5 * 60) {
if let Some(peer) = peers.most_work_peer() { if let Some(peer) = peers.most_work_peer() {
if let Ok(p) = peer.try_read() { if let Ok(p) = peer.try_read() {
debug!(
LOGGER,
"Header head before txhashset request: {} / {}",
header_head.height,
header_head.last_block_h
);
// just to handle corner case of a too early start // just to handle corner case of a too early start
if header_head.height > horizon { if header_head.height > horizon {
debug!(
LOGGER,
"Header head before txhashset request: {} / {}",
header_head.height,
header_head.last_block_h
);
// ask for txhashset at horizon // ask for txhashset at horizon
let mut txhashset_head = let mut txhashset_head =
chain.get_block_header(&header_head.prev_block_h).unwrap(); chain.get_block_header(&header_head.prev_block_h).unwrap();
for _ in 0..horizon - 2 { for _ in 0..horizon - 2 {
txhashset_head = txhashset_head = chain
chain.get_block_header(&txhashset_head.previous).unwrap(); .get_block_header(&txhashset_head.previous)
.unwrap();
} }
p.send_txhashset_request( p.send_txhashset_request(
txhashset_head.height, txhashset_head.height,
@ -259,7 +260,8 @@ fn needs_syncing(
if is_syncing { if is_syncing {
if let Some(peer) = peer { if let Some(peer) = peer {
if let Ok(peer) = peer.try_read() { if let Ok(peer) = peer.try_read() {
debug!(LOGGER, debug!(
LOGGER,
"needs_syncing {} {} {}", local_diff, peer.info.total_difficulty, header_only "needs_syncing {} {} {}", local_diff, peer.info.total_difficulty, header_only
); );
@ -278,7 +280,7 @@ fn needs_syncing(
} }
} else { } else {
info!(LOGGER, "sync: no peers available, disabling sync"); info!(LOGGER, "sync: no peers available, disabling sync");
return false return false;
} }
} else { } else {
if let Some(peer) = peer { if let Some(peer) = peer {
@ -298,7 +300,7 @@ fn needs_syncing(
peer.info.total_difficulty, peer.info.total_difficulty,
threshold, threshold,
); );
return true return true;
} }
} }
} }