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

View File

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

View File

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