bugfixes for pool detection and runner error reporting

This commit is contained in:
Tim
2024-01-26 21:59:31 -04:00
parent 455df0f038
commit c9d7a6f4dd
2 changed files with 13 additions and 1 deletions

View File

@@ -41,6 +41,12 @@ class Pools:
except ContractLogicError: except ContractLogicError:
log.debug(f'new Unknown pool at {address}') log.debug(f'new Unknown pool at {address}')
found = Pool(chain=chain, address=address, exchange=Exchange.Unknown, base=ADDRESS_0, quote=ADDRESS_0, fee=0) found = Pool(chain=chain, address=address, exchange=Exchange.Unknown, base=ADDRESS_0, quote=ADDRESS_0, fee=0)
except ValueError as v:
if v.args[0].get('code') == -32000:
log.debug(f'new Unknown pool at {address}')
found = Pool(chain=chain, address=address, exchange=Exchange.Unknown, base=ADDRESS_0, quote=ADDRESS_0, fee=0)
else:
raise
db.session.add(found) db.session.add(found)
Pools.instances[key] = found Pools.instances[key] = found
return None if found.exchange == Exchange.Unknown else found return None if found.exchange == Exchange.Unknown else found

View File

@@ -323,7 +323,13 @@ class BlockStateRunner:
if not self.state_initialized: if not self.state_initialized:
await self.do_state_init_cbs() await self.do_state_init_cbs()
# logevent callbacks # logevent callbacks
for future, callback, event, filter_args in batches: while True:
try:
# we remove entries as we process them, so the exception handler doesn't re-await the callbacks
batch = batches.pop(0)
except IndexError:
break
future, callback, event, filter_args = batch
if future is None: if future is None:
await maywait(callback()) # non-log callback await maywait(callback()) # non-log callback
else: else: