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:
parent
e0817d1747
commit
2a4a89c002
|
|
@ -83,11 +83,12 @@ impl StateService {
|
||||||
/// in RFC0005.
|
/// in RFC0005.
|
||||||
///
|
///
|
||||||
/// [1]: https://zebra.zfnd.org/dev/rfcs/0005-state-updates.html#committing-non-finalized-blocks
|
/// [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(
|
fn queue_and_commit_non_finalized(
|
||||||
&mut self,
|
&mut self,
|
||||||
prepared: PreparedBlock,
|
prepared: PreparedBlock,
|
||||||
) -> oneshot::Receiver<Result<block::Hash, BoxError>> {
|
) -> 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;
|
let parent_hash = prepared.block.header.previous_block_hash;
|
||||||
|
|
||||||
if self.mem.any_chain_contains(&prepared.hash) || self.disk.hash(prepared.height).is_some()
|
if self.mem.any_chain_contains(&prepared.hash) || self.disk.hash(prepared.height).is_some()
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,16 @@ pub struct Chain {
|
||||||
|
|
||||||
impl Chain {
|
impl Chain {
|
||||||
/// Push a contextually valid non-finalized block into a chain as the new tip.
|
/// 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) {
|
pub fn push(&mut self, block: PreparedBlock) {
|
||||||
// update cumulative data members
|
// update cumulative data members
|
||||||
self.update_chain_state_with(&block);
|
self.update_chain_state_with(&block);
|
||||||
|
tracing::info!(block = %block.block, "adding block to chain");
|
||||||
self.blocks.insert(block.height, 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.
|
/// 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 {
|
pub fn pop_root(&mut self) -> PreparedBlock {
|
||||||
let block_height = self.lowest_height();
|
let block_height = self.lowest_height();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ where
|
||||||
/// This method waits for the network to become ready, and returns an error
|
/// This method waits for the network to become ready, and returns an error
|
||||||
/// only if the network service fails. It returns immediately after queuing
|
/// only if the network service fails. It returns immediately after queuing
|
||||||
/// the request.
|
/// 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> {
|
pub async fn download_and_verify(&mut self, hash: block::Hash) -> Result<(), Report> {
|
||||||
if self.cancel_handles.contains_key(&hash) {
|
if self.cancel_handles.contains_key(&hash) {
|
||||||
return Err(eyre!("duplicate hash queued for download"));
|
return Err(eyre!("duplicate hash queued for download"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue