Skip to content

Commit

Permalink
Ensure transactions are finalized so outputs are available in the led…
Browse files Browse the repository at this point in the history
…ger update store (#1381)

* analytics: ensure finalized transactions

* suggestions
  • Loading branch information
Alex6323 authored Apr 23, 2024
1 parent 8115acb commit 1982985
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/analytics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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?;
}
Expand Down

0 comments on commit 1982985

Please sign in to comment.