Record BEACON_BLOCK_DELAY_GOSSIP metric only after a bock is verified (#6046)

* Only record metrics after block verified
This commit is contained in:
chonghe
2024-07-05 10:37:54 +08:00
committed by GitHub
parent d84e3e391e
commit 8e0bc9a40b

View File

@@ -907,17 +907,19 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
get_block_delay_ms(seen_duration, block.message(), &self.chain.slot_clock);
// Log metrics to track delay from other nodes on the network.
metrics::set_gauge(
&metrics::BEACON_BLOCK_DELAY_GOSSIP,
block_delay.as_millis() as i64,
);
let verification_result = self
.chain
.clone()
.verify_block_for_gossip(block.clone())
.await;
if verification_result.is_ok() {
metrics::set_gauge(
&metrics::BEACON_BLOCK_DELAY_GOSSIP,
block_delay.as_millis() as i64,
);
}
let block_root = if let Ok(verified_block) = &verification_result {
verified_block.block_root
} else {