Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/actors/monitor/txn_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
use std::sync::Arc;
use std::time::{Duration, Instant};

use alloy::consensus::Account;
use alloy::primitives::TxHash;
use comfy_table::{presets::UTF8_FULL, Attribute, Cell, Color, Table};
use tracing::{debug, error, warn};
Expand Down Expand Up @@ -338,7 +337,7 @@ impl TxnTracker {
impl std::future::Future<
Output = (
PendingTxInfo,
Result<Account, anyhow::Error>,
Result<u64, anyhow::Error>,
Result<Option<alloy::rpc::types::TransactionReceipt>, anyhow::Error>,
),
>,
Expand Down Expand Up @@ -378,15 +377,15 @@ impl TxnTracker {

let task = async move {
let result = client.get_transaction_receipt(task_info.tx_hash).await;
let account = client
.get_account(*task_info.metadata.from_account.as_ref())
let nonce = client
.get_txn_count(*task_info.metadata.from_account.as_ref())
.await;
tracing::debug!(
"checked tx_hash={:?} result={:?}",
task_info.tx_hash,
result
);
(task_info, account, result)
(task_info, nonce, result)
};
tasks.push(task);
} else {
Expand All @@ -401,7 +400,7 @@ impl TxnTracker {
&mut self,
results: Vec<(
PendingTxInfo,
Result<Account, anyhow::Error>,
Result<u64, anyhow::Error>,
Result<Option<alloy::rpc::types::TransactionReceipt>, anyhow::Error>,
)>,
) -> Vec<RetryTxnInfo> {
Expand All @@ -410,7 +409,7 @@ impl TxnTracker {
let mut retry_queue = Vec::new();

// 1. Categorize results
for (info, account, result) in results {
for (info, nonce_result, result) in results {
match result {
Ok(Some(receipt)) => {
// Transaction successfully confirmed
Expand All @@ -419,8 +418,8 @@ impl TxnTracker {
}
Ok(None) => {
// Transaction still pending
if let Ok(account) = account {
if account.nonce > info.metadata.nonce {
if let Ok(current_nonce) = nonce_result {
if current_nonce > info.metadata.nonce {
successful_txns.push((info, true));
}
} else {
Expand Down
Loading