Skip to content

Commit

Permalink
Log an info message for block broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Sep 24, 2021
1 parent f2a0144 commit 9af60a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zebra-state/src/service/chain_tip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,15 @@ impl TipAction {
}
}

/// Returns the block height of this tip action,
/// regardless of the underlying variant.
pub fn best_tip_height(&self) -> block::Height {
match self {
Grow { block } => block.height,
Reset { height, .. } => *height,
}
}

/// Returns a [`Grow`] based on `block`.
pub(crate) fn grow_with(block: ChainTipBlock) -> Self {
Grow { block }
Expand Down
3 changes: 3 additions & 0 deletions zebrad/src/components/sync/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ where
// unlike the mempool, we don't care if the change is a reset
let request = zn::Request::AdvertiseBlock(tip_action.best_tip_hash());

let height = tip_action.best_tip_height();
info!(?height, ?request, "sending verified block broadcast");

// broadcast requests don't return errors, and we'd just want to ignore them anyway
let _ = broadcast_network.ready_and().await?.call(request).await;
}
Expand Down

0 comments on commit 9af60a9

Please sign in to comment.