From 850bbb8f3a23e61b5f827a32f194fe8fa77cc62c Mon Sep 17 00:00:00 2001 From: imsk17 Date: Tue, 10 Sep 2024 12:05:07 +0530 Subject: [PATCH] fix(nonce-manager): change nonce management logic --- src/deps.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/deps.ts b/src/deps.ts index d7c3f0f..0c7ddc5 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -388,18 +388,13 @@ export async function configDeps( const storageSigner = new NonceManager( new Wallet(secrets.evmWallet.privateKey, storageProvider), ); - const nonce = { n: await storageSigner.getNonce(), used: false }; + let nonce = await storageSigner.getNonce(); const lock = new Mutex(); const fetchNonce = async () => { const release = await lock.acquire(); - if (nonce.used) { - nonce.n = nonce.n + 1; - nonce.used = false; - return [nonce.n, release] as const; - } - nonce.used = true; - return [nonce.n, release] as const; + nonce += 1; + return [nonce, release] as const; }; const storage = BridgeStorage__factory.connect(