From 19829855f5e0ea146c55c90adac2db371f4c2607 Mon Sep 17 00:00:00 2001 From: /alex/ Date: Tue, 23 Apr 2024 11:49:38 +0200 Subject: [PATCH] Ensure transactions are finalized so outputs are available in the ledger update store (#1381) * analytics: ensure finalized transactions * suggestions --- src/analytics/mod.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/analytics/mod.rs b/src/analytics/mod.rs index 465bd7ddd..77db0b333 100644 --- a/src/analytics/mod.rs +++ b/src/analytics/mod.rs @@ -4,12 +4,15 @@ //! Various analytics that give insight into the usage of the tangle. use futures::{prelude::stream::StreamExt, TryStreamExt}; -use iota_sdk::types::block::{ - output::OutputId, - payload::SignedTransactionPayload, - protocol::ProtocolParameters, - slot::{EpochIndex, SlotCommitment, SlotIndex}, - Block, +use iota_sdk::types::{ + api::core::TransactionState, + block::{ + output::OutputId, + payload::SignedTransactionPayload, + protocol::ProtocolParameters, + slot::{EpochIndex, SlotCommitment, SlotIndex}, + Block, + }, }; use thiserror::Error; @@ -324,7 +327,9 @@ impl<'a, I: InputSource> Slot<'a, I> { .and_then(|p| p.as_signed_transaction_opt()) .zip(data.transaction) { - self.handle_transaction(analytics, payload, &metadata, &ctx).await?; + if metadata.transaction_state == Some(TransactionState::Finalized) { + self.handle_transaction(analytics, payload, &metadata, &ctx).await?; + } } self.handle_block(analytics, &data.block, &ctx).await?; }