Compare commits

..

2 Commits

Author SHA1 Message Date
tim
4740687167 account release bugfix 2025-03-19 21:05:19 -04:00
tim
a06eeeb10d bugfix 2025-03-19 17:31:34 -04:00
3 changed files with 16 additions and 9 deletions

View File

@@ -190,6 +190,7 @@ async def main():
while True: while True:
wake_up = now() + delay wake_up = now() + delay
# log.debug(f'querying {pool}') # log.debug(f'querying {pool}')
tx = None
try: try:
price = await get_pool_price(pool) price = await get_pool_price(pool)
if price != last_prices.get(pool): if price != last_prices.get(pool):
@@ -200,7 +201,10 @@ 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:
tx.account.reset_nonce()
tx.account.release()
continue continue
try: try:
pool = next(pool_iter) pool = next(pool_iter)

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

View File

@@ -614,11 +614,11 @@ class TrancheTrigger:
self.order_trigger.expire_tranche(self.tk.tranche_index) self.order_trigger.expire_tranche(self.tk.tranche_index)
def expire(self): def expire(self):
self.disable()
if self.closed: if self.closed:
return return
order_log.debug(f'tranche expired {self.tk}') order_log.debug(f'tranche expired {self.tk}')
self.status = TrancheState.Expired self.status = TrancheState.Expired
self.disable()
def kill(self): def kill(self):
order_log.warning(f'tranche KILLED {self.tk}') order_log.warning(f'tranche KILLED {self.tk}')