Skip to content

feat: Implement transaction status tracking with mempool detection and confirmation threshold#35

Open
Ignacio-87 wants to merge 14 commits intodevfrom
change-get-transaction
Open

feat: Implement transaction status tracking with mempool detection and confirmation threshold#35
Ignacio-87 wants to merge 14 commits intodevfrom
change-get-transaction

Conversation

@Ignacio-87
Copy link
Collaborator

@Ignacio-87 Ignacio-87 commented Jan 26, 2026

Changes

Add transaction status tracking with mempool support and confirmation threshold

Implement transaction status tracking, allowing users to determine the current state of transactions in the blockchain.

  • Add TransactionBlockchainStatus enum new states: InMempool, NotFound
  • Add helper methods to TransactionStatus: is_finalized(), is_confirmed(), is_orphan()
  • Add confirmation_threshold setting to IndexerSettings and DEFAULT_CONFIRMATION_THRESHOLD constant to settings.rs
  • Update README with documentation for transaction status and configuration

Fix Change

  • This branch includes a fix for block reorganization issues. Previously, when the top block was invalidated, it was not correctly marked as invalid, and the related transaction block information was not marked as orphaned.

@Ignacio-87 Ignacio-87 force-pushed the change-get-transaction branch from e119e2c to 6b45ec2 Compare February 4, 2026 14:09
…ted types

Also ajust param when calling mark_following_blocks_as_orphan
Replace unwrap() calls with proper error handling:
- Add MissingTransactionData and MissingBlockInfo error variants
- Replace tx_id() with tx_id_or_error() returning Result
- Add tx_or_err() and block_info_or_err() helper methods

This makes the code more robust by avoiding panics and providing
descriptive error messages when transaction or block data is missing.
@jonasmartin jonasmartin self-requested a review February 19, 2026 19:48
src/types.rs Outdated
pub block_info: Option<FullBlock>,
pub confirmations: u32,
pub status: TransactionBlockchainStatus,
pub confirmation_threshold: u32,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are serveral changes to be able to suppor is_finalized() that could be kept as it was before is_finaled(&self, confirmation_threshold: u32)
The value is being sent to the indexer to came back and finally being used just by the coordinator.
I think it's better to remove the threshold from here and make the function get the trheshold as parameter

Copy link
Collaborator Author

@Ignacio-87 Ignacio-87 Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Join confirmation_threshold with max_monitoring_confirmations and pass value as a param in is_finalized method

Remove confirmation_threshold as a stored field and pass it as parameter instead:
- Remove confirmation_threshold from IndexerSettings config
- Remove confirmation_threshold field from TransactionStatus
- Remove confirmation_threshold field from IndexerStore
- Change is_finalized() to accept max_monitoring_confirmations as parameter
- Update all IndexerStore::new() calls to remove threshold parameter
- Remove DEFAULT_CONFIRMATION_THRESHOLD constant

This refactoring makes the code more flexible by allowing the confirmation
threshold to be passed dynamically when checking if a transaction is finalized,
rather than storing it in each TransactionStatus instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants