Skip to content

Commit

Permalink
fix: nonce resync worker returns too early with multiple sender walle…
Browse files Browse the repository at this point in the history
…ts (#724)
  • Loading branch information
arcoraven authored Oct 11, 2024
1 parent 80300b6 commit 42ee0b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/worker/tasks/nonceResyncWorker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Job, Processor, Worker } from "bullmq";
import { Worker, type Job, type Processor } from "bullmq";
import { eth_getTransactionCount, getRpcClient } from "thirdweb";
import {
inspectNonce,
Expand Down Expand Up @@ -58,7 +58,7 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
inspectNonce(chainId, walletAddress),
]);

if (isNaN(transactionCount)) {
if (Number.isNaN(transactionCount)) {
job.log(
`Received invalid onchain transaction count for ${walletAddress}: ${transactionCount}`,
);
Expand All @@ -67,7 +67,7 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
message: `[nonceResyncWorker] Received invalid onchain transaction count for ${walletAddress}: ${transactionCount}`,
service: "worker",
});
return;
continue;
}

const lastUsedNonceOnchain = transactionCount - 1;
Expand All @@ -90,7 +90,7 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
message: `[nonceResyncWorker] No need to resync nonce for ${walletAddress}`,
service: "worker",
});
return;
continue;
}

// for each nonce between last used db nonce and last used onchain nonce
Expand Down

0 comments on commit 42ee0b0

Please sign in to comment.