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] addr, inverted = mirror_pools[pool]
log.debug(f'Mirrored {addr} {price}') log.debug(f'Mirrored {addr} {price}')
except Exception as x: 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: if tx is not None:
tx.account.reset_nonce() tx.account.reset_nonce()
tx.account.release() tx.account.release()

View File

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