mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
nonce-tracker - wrap nonce calculations in try-catch and release lock on error
This commit is contained in:
parent
030fea7136
commit
c86f935889
@ -50,6 +50,7 @@ class NonceTracker {
|
||||
await this._globalMutexFree()
|
||||
// await lock free, then take lock
|
||||
const releaseLock = await this._takeMutex(address)
|
||||
try {
|
||||
// evaluate multiple nextNonce strategies
|
||||
const nonceDetails = {}
|
||||
const networkNonceResult = await this._getNetworkNextNonce(address)
|
||||
@ -73,6 +74,11 @@ class NonceTracker {
|
||||
|
||||
// return nonce and release cb
|
||||
return { nextNonce, nonceDetails, releaseLock }
|
||||
} catch (err) {
|
||||
// release lock if we encounter an error
|
||||
releaseLock()
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async _globalMutexFree () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user