account release bugfix

This commit is contained in:
tim
2025-03-19 21:05:19 -04:00
parent a06eeeb10d
commit 4740687167
2 changed files with 11 additions and 8 deletions

View File

@@ -201,7 +201,7 @@ async def main():
addr, inverted = mirror_pools[pool]
log.debug(f'Mirrored {addr} {price}')
except Exception as x:
log.debug(f'Could not update {pool}: {x}')
log.debug(f'Could not update {pool}: {x} {tx}')
if tx is not None:
tx.account.reset_nonce()
tx.account.release()

View File

@@ -81,6 +81,7 @@ def transact_wrapper(addr, name, func):
account = await Account.acquire()
if account is None:
raise ValueError(f'No account to sign transaction {addr}.{name}()')
try:
await ct.sign(account)
try:
tx_id = await current_w3.get().eth.send_raw_transaction(ct.data)
@@ -89,6 +90,8 @@ def transact_wrapper(addr, name, func):
except Web3Exception as e:
e.args += addr, name
raise e
finally:
account.release()
return f