pub struct TxTracker { /* private fields */ }Expand description
Core transaction tracker that monitors pending transactions.
Thread-safe via interior Mutex — suitable for shared access across
Tokio tasks behind an Arc.
Implementations§
Source§impl TxTracker
impl TxTracker
Sourcepub fn new(config: TxTrackerConfig) -> Self
pub fn new(config: TxTrackerConfig) -> Self
Create a new tracker with the given configuration.
Sourcepub fn track(&self, tx: TrackedTx)
pub fn track(&self, tx: TrackedTx)
Track a new pending transaction.
If the tracker is already at capacity (max_tracked), the transaction
is silently dropped.
Sourcepub fn update_status(&self, tx_hash: &str, status: TxStatus)
pub fn update_status(&self, tx_hash: &str, status: TxStatus)
Update the status of a tracked transaction.
Does nothing if tx_hash is not currently tracked.
Sourcepub fn by_status(&self, status_match: &TxStatus) -> Vec<TrackedTx>
pub fn by_status(&self, status_match: &TxStatus) -> Vec<TrackedTx>
Get all transactions whose status matches status_match.
Comparison uses the discriminant only for variant-carrying statuses;
for simple variants (Pending, Dropped) it uses PartialEq.
Sourcepub fn stuck(&self, current_time: u64) -> Vec<TrackedTx>
pub fn stuck(&self, current_time: u64) -> Vec<TrackedTx>
Get transactions that appear stuck (pending longer than stuck_timeout_secs).
Sourcepub fn next_nonce(&self, address: &str) -> Option<u64>
pub fn next_nonce(&self, address: &str) -> Option<u64>
Get the next nonce for an address (local tracking).
Returns the stored nonce + 1, or None if the address has never been
registered.