From 36cd76d59049e479d8fb342101c578e9a3474990 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Fri, 20 Nov 2020 19:54:57 -0800 Subject: [PATCH] state: tidy process_queued tracing Previously, this function was instrumented with a span containing the parent hash that was the entry to the function. But it doesn't make sense to consider the work done by the function as happening in the context of the supplied parent hash (as distinct from the context of the hash of the newly arrived block, which is already contained in an outer span), so this adds noise without conveying extra context. Instead, use events that occur within the context of the existing spans. --- zebra-state/src/service.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index e1a0339a..b50f6282 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -167,21 +167,21 @@ impl StateService { /// Attempt to validate and commit all queued blocks whose parents have /// recently arrived starting from `new_parent`, in breadth-first ordering. - #[instrument(skip(self))] fn process_queued(&mut self, new_parent: block::Hash) { let mut new_parents = vec![new_parent]; - while let Some(parent) = new_parents.pop() { - let queued_children = self.queued_blocks.dequeue_children(parent); + while let Some(parent_hash) = new_parents.pop() { + let queued_children = self.queued_blocks.dequeue_children(parent_hash); for QueuedBlock { block, rsp_tx } in queued_children { - let hash = block.hash(); + let child_hash = block.hash(); + tracing::trace!(?child_hash, "validating queued child"); let result = self .validate_and_commit(block) - .map(|()| hash) + .map(|()| child_hash) .map_err(BoxError::from); let _ = rsp_tx.send(result); - new_parents.push(hash); + new_parents.push(child_hash); } } }