state: shorten tracing messages

Make tracing messages more concise by omitting information already
contained in a parent span and by shortening messages.  This makes them
easier to read.
This commit is contained in:
Henry de Valence 2020-11-20 19:58:39 -08:00 committed by teor
parent 3192a5008d
commit 719a48ad9e
2 changed files with 10 additions and 8 deletions

View File

@ -35,12 +35,10 @@ impl Chain {
let block_height = block
.coinbase_height()
.expect("valid non-finalized blocks have a coinbase height");
trace!(?block_height, "Pushing new block into chain state");
// update cumulative data members
self.update_chain_state_with(&block);
self.blocks.insert(block_height, block);
trace!("pushed block onto chain");
}
/// Remove the lowest height block of the non-finalized portion of a chain.

View File

@ -48,17 +48,17 @@ impl QueuedBlocks {
.insert(new_hash);
assert!(inserted, "hashes must be unique");
tracing::trace!(num_blocks = %self.blocks.len(), %parent_hash, ?new_height, "Finished queueing a new block");
tracing::trace!(%parent_hash, queued = %self.blocks.len(), "queued block");
self.update_metrics();
}
/// Dequeue and return all blocks that were waiting for the arrival of
/// `parent`.
#[instrument(skip(self))]
pub fn dequeue_children(&mut self, parent: block::Hash) -> Vec<QueuedBlock> {
#[instrument(skip(self), fields(%parent_hash))]
pub fn dequeue_children(&mut self, parent_hash: block::Hash) -> Vec<QueuedBlock> {
let queued_children = self
.by_parent
.remove(&parent)
.remove(&parent_hash)
.unwrap_or_default()
.into_iter()
.map(|hash| {
@ -73,7 +73,11 @@ impl QueuedBlocks {
self.by_height.remove(&height);
}
tracing::trace!(num_blocks = %self.blocks.len(), "Finished dequeuing blocks waiting for parent hash",);
tracing::trace!(
dequeued = queued_children.len(),
remaining = self.blocks.len(),
"dequeued blocks"
);
self.update_metrics();
queued_children