fixed last error from tendermint/test_core.py

This commit is contained in:
andrei 2022-04-25 16:41:56 +03:00
parent 145838d1c3
commit 8966a7b3a9

View File

@ -379,7 +379,9 @@ def store_pre_commit_state(connection, state: dict):
@register_query(TarantoolDB) @register_query(TarantoolDB)
def get_pre_commit_state(connection): def get_pre_commit_state(connection):
space = connection.space("pre_commits") space = connection.space("pre_commits")
_commit = space.select([], index="id_search").data _commit = space.select([], index="id_search", limit=1).data
if len(_commit) == 0:
return None
_commit = sorted(_commit, key=itemgetter(1), reverse=True)[0] _commit = sorted(_commit, key=itemgetter(1), reverse=True)[0]
return {"height": _commit[1], "transactions": _commit[2]} return {"height": _commit[1], "transactions": _commit[2]}
@ -450,7 +452,9 @@ def get_election(connection, election_id: str):
space = connection.space("elections") space = connection.space("elections")
_elections = space.select(election_id, index="id_search") _elections = space.select(election_id, index="id_search")
_elections = _elections.data _elections = _elections.data
_election = sorted(_elections, key=itemgetter(0))[0] if len(_elections) == 0:
return None
_election = sorted(_elections, key=itemgetter(0), reverse=True)[0]
return {"election_id": _election[0], "height": _election[1], "is_concluded": _election[2]} return {"election_id": _election[0], "height": _election[1], "is_concluded": _election[2]}