From f0810b028d9359035e5f45cde8ab90aa7766f4d6 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Fri, 20 Nov 2020 19:52:44 -0800 Subject: [PATCH] state,consensus,sync: shorten span lengths These changes help reduce the size of the resulting spans, making the output more compact. Together they save about 30-40 characters. --- zebra-consensus/src/transaction.rs | 2 +- zebra-state/src/service.rs | 6 +++--- zebra-state/src/service/finalized_state.rs | 2 +- zebrad/src/components/sync/downloads.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zebra-consensus/src/transaction.rs b/zebra-consensus/src/transaction.rs index d44f1a746..39ca1a665 100644 --- a/zebra-consensus/src/transaction.rs +++ b/zebra-consensus/src/transaction.rs @@ -88,7 +88,7 @@ where let mut redjubjub_verifier = crate::primitives::redjubjub::VERIFIER.clone(); let mut script_verifier = self.script_verifier.clone(); - let span = tracing::debug_span!("tx", hash = ?tx.hash()); + let span = tracing::debug_span!("tx", hash = %tx.hash()); async move { tracing::trace!(?tx); match &*tx { diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index 5593cec27..e1a0339a3 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -86,7 +86,7 @@ impl StateService { /// /// [1]: https://zebra.zfnd.org/dev/rfcs/0005-state-updates.html#committing-non-finalized-blocks #[instrument(skip(self, block))] - fn queue_and_commit_non_finalized_blocks( + fn queue_and_commit_non_finalized( &mut self, block: Arc, ) -> oneshot::Receiver> { @@ -390,7 +390,7 @@ impl Service for StateService { metrics::counter!("state.requests", 1, "type" => "commit_block"); self.pending_utxos.check_block(&block); - let rsp_rx = self.queue_and_commit_non_finalized_blocks(block); + let rsp_rx = self.queue_and_commit_non_finalized(block); async move { rsp_rx @@ -408,7 +408,7 @@ impl Service for StateService { self.pending_utxos.check_block(&block); self.disk - .queue_and_commit_finalized_blocks(QueuedBlock { block, rsp_tx }); + .queue_and_commit_finalized(QueuedBlock { block, rsp_tx }); async move { rsp_rx diff --git a/zebra-state/src/service/finalized_state.rs b/zebra-state/src/service/finalized_state.rs index 2cd3c8e74..dc3e2b0cd 100644 --- a/zebra-state/src/service/finalized_state.rs +++ b/zebra-state/src/service/finalized_state.rs @@ -92,7 +92,7 @@ impl FinalizedState { /// /// After queueing a finalized block, this method checks whether the newly /// queued block (and any of its descendants) can be committed to the state. - pub fn queue_and_commit_finalized_blocks(&mut self, queued_block: QueuedBlock) { + pub fn queue_and_commit_finalized(&mut self, queued_block: QueuedBlock) { let prev_hash = queued_block.block.header.previous_block_hash; let height = queued_block.block.coinbase_height().unwrap(); self.queued_by_prev_hash.insert(prev_hash, queued_block); diff --git a/zebrad/src/components/sync/downloads.rs b/zebrad/src/components/sync/downloads.rs index 177a27c0a..b3ae41690 100644 --- a/zebrad/src/components/sync/downloads.rs +++ b/zebrad/src/components/sync/downloads.rs @@ -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))] + #[instrument(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"));