wrap try/finally around populateTransaction logic to ensure the lock is always released in the case of an error
This commit is contained in:
parent
2428b756d6
commit
16b28f4535
|
@ -103,6 +103,7 @@ method populateTransaction*(signer: Signer,
|
|||
|
||||
var populated = transaction
|
||||
|
||||
try:
|
||||
if transaction.sender.isNone:
|
||||
populated.sender = some(await signer.getAddress())
|
||||
if transaction.chainId.isNone:
|
||||
|
@ -122,8 +123,6 @@ method populateTransaction*(signer: Signer,
|
|||
let e = getCurrentException()
|
||||
signer.decreaseNonce()
|
||||
raise e
|
||||
finally:
|
||||
signer.populateLock.release()
|
||||
|
||||
else:
|
||||
if transaction.nonce.isNone:
|
||||
|
@ -131,6 +130,9 @@ method populateTransaction*(signer: Signer,
|
|||
if transaction.gasLimit.isNone:
|
||||
populated.gasLimit = some(await signer.estimateGas(populated))
|
||||
|
||||
finally:
|
||||
signer.populateLock.release()
|
||||
|
||||
return populated
|
||||
|
||||
method cancelTransaction*(
|
||||
|
|
Loading…
Reference in New Issue