state,zebrad: tidy span levels for good INFO output

This provides useful and not too noisy output at INFO level.  We do an
info-level message on every block commit instead of trying to do one
message every N blocks, because this is useful both for initial block
sync as well as continuous state updates on new blocks.
This commit is contained in:
Henry de Valence 2020-11-21 10:41:53 -08:00 committed by teor
parent e0817d1747
commit 2a4a89c002
3 changed files with 6 additions and 5 deletions

View File

@ -83,11 +83,12 @@ impl StateService {
/// in RFC0005.
///
/// [1]: https://zebra.zfnd.org/dev/rfcs/0005-state-updates.html#committing-non-finalized-blocks
#[instrument(skip(self, prepared))]
#[instrument(level = "debug", skip(self, prepared))]
fn queue_and_commit_non_finalized(
&mut self,
prepared: PreparedBlock,
) -> oneshot::Receiver<Result<block::Hash, BoxError>> {
tracing::debug!(block = %prepared.block, "queueing block for contextual verification");
let parent_hash = prepared.block.header.previous_block_hash;
if self.mem.any_chain_contains(&prepared.hash) || self.disk.hash(prepared.height).is_some()

View File

@ -29,16 +29,16 @@ pub struct Chain {
impl Chain {
/// Push a contextually valid non-finalized block into a chain as the new tip.
#[instrument(skip(self, block), fields(block = %block.block))]
#[instrument(level = "debug", skip(self, block), fields(block = %block.block))]
pub fn push(&mut self, block: PreparedBlock) {
// update cumulative data members
self.update_chain_state_with(&block);
tracing::info!(block = %block.block, "adding block to chain");
self.blocks.insert(block.height, block);
trace!("pushed block onto chain");
}
/// Remove the lowest height block of the non-finalized portion of a chain.
#[instrument(skip(self))]
#[instrument(level = "debug", skip(self))]
pub fn pop_root(&mut self) -> PreparedBlock {
let block_height = self.lowest_height();

View File

@ -110,7 +110,7 @@ where
/// This method waits for the network to become ready, and returns an error
/// only if the network service fails. It returns immediately after queuing
/// the request.
#[instrument(skip(self), fields(%hash))]
#[instrument(level = "debug", skip(self), fields(%hash))]
pub async fn download_and_verify(&mut self, hash: block::Hash) -> Result<(), Report> {
if self.cancel_handles.contains_key(&hash) {
return Err(eyre!("duplicate hash queued for download"));