bugfix
This commit is contained in:
@@ -43,7 +43,7 @@ async def _fetch(fetch: FetchLock, chain_id: int, block_id: Union[int,bytes]) ->
|
||||
if type(block_id) is int:
|
||||
# by-number could return multiple results
|
||||
# noinspection PyTypeChecker
|
||||
blocks: list[DbBlock] = db.session.execute(select(DbBlock).where(
|
||||
blocks: list[DbBlock] = db.session.scalars(select(DbBlock).where(
|
||||
DbBlock.chain == chain,
|
||||
DbBlock.height == block_id
|
||||
)).all()
|
||||
@@ -53,7 +53,11 @@ async def _fetch(fetch: FetchLock, chain_id: int, block_id: Union[int,bytes]) ->
|
||||
else:
|
||||
found = db.session.get(DbBlock, dict(chain=chain, hash=block_id)) # by-hash is the primary key
|
||||
if found:
|
||||
return Block(chain_id, found.data)
|
||||
log.debug(f'found block: {found}')
|
||||
try:
|
||||
return Block(chain_id, found.data)
|
||||
except AttributeError:
|
||||
log.exception(f'found was {found}')
|
||||
|
||||
# fetch from RPC
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user