Skip to content

Commit b1b244a

Browse files
committed
Guard against a potential infinite loop from a non-nonce issue
1 parent 062aba4 commit b1b244a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/package-utils/ExtendedNonceManager.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ class ExtendedNonceManager extends NonceManager {
4646
this.signedTransactions[tx.hash] = signedTransaction;
4747
return response;
4848
} catch (e) {
49-
const txCount = await this.signer.getTransactionCount("pending");
50-
this.setTransactionCount(txCount);
51-
return this.sendTransaction(transactionRequest);
49+
if (e.code === "NONCE_EXPIRED") {
50+
// The nonce has expired, so we need to update it.
51+
const txCount = await this.signer.getTransactionCount("pending");
52+
this.setTransactionCount(txCount);
53+
return this.sendTransaction(transactionRequest);
54+
}
55+
console.log(e);
56+
throw e;
5257
}
5358
}
5459
}

0 commit comments

Comments
 (0)