diff --git a/src/worker/tasks/sendTransactionWorker.ts b/src/worker/tasks/sendTransactionWorker.ts index 990ac1e35..b2a562172 100644 --- a/src/worker/tasks/sendTransactionWorker.ts +++ b/src/worker/tasks/sendTransactionWorker.ts @@ -50,12 +50,22 @@ const handler: Processor = async (job: Job) => { job.data, ); - const transaction = await TransactionDB.get(queueId); + let transaction = await TransactionDB.get(queueId); if (!transaction) { job.log(`Invalid transaction state: ${stringify(transaction)}`); return; } + // The transaction may be errored if it is manually retried. + // For example, the developer retried all failed transactions during an RPC outage. + // An errored queued transaction (resendCount = 0) is safe to retry: the transaction wasn't sent to RPC. + if (transaction.status === "errored" && resendCount === 0) { + transaction = { + ...transaction, + status: "queued", + } satisfies QueuedTransaction; + } + // SentTransaction = the transaction or userOp was submitted successfully. // ErroredTransaction = the transaction failed and should not be re-attempted. // null = the transaction attemped to resend but was not needed. Ignore.