From a302ebe95711d3fb52ed015c0ccb029f3408500c Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Thu, 7 Mar 2024 09:11:45 -0500 Subject: [PATCH] do not count validation blocks as no payload --- src/analytics/tangle/block_activity.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/analytics/tangle/block_activity.rs b/src/analytics/tangle/block_activity.rs index 18ec4ab71..509f9ef4f 100644 --- a/src/analytics/tangle/block_activity.rs +++ b/src/analytics/tangle/block_activity.rs @@ -42,15 +42,17 @@ impl Analytics for BlockActivityMeasurement { _ctx: &dyn AnalyticsContext, ) -> eyre::Result<()> { match block.body() { - BlockBody::Basic(_) => self.basic_count += 1, + BlockBody::Basic(basic_body) => { + self.basic_count += 1; + match basic_body.payload() { + Some(Payload::TaggedData(_)) => self.tagged_data_count += 1, + Some(Payload::SignedTransaction(_)) => self.transaction_count += 1, + Some(Payload::CandidacyAnnouncement(_)) => self.candidacy_announcement_count += 1, + None => self.no_payload_count += 1, + } + } BlockBody::Validation(_) => self.validation_count += 1, } - match block.body().as_basic_opt().and_then(|b| b.payload()) { - Some(Payload::TaggedData(_)) => self.tagged_data_count += 1, - Some(Payload::SignedTransaction(_)) => self.transaction_count += 1, - Some(Payload::CandidacyAnnouncement(_)) => self.candidacy_announcement_count += 1, - None => self.no_payload_count += 1, - } match &metadata.block_state { BlockState::Pending => self.block_pending_count += 1, BlockState::Accepted => self.block_accepted_count += 1,