Skip to content

Commit

Permalink
Merge branch 'kyle/22-index-votes' into ryan/22-docker-and-test
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo authored Aug 31, 2023
2 parents 7b63297 + af2fcd9 commit 633169d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def fetch_votes_by_proposal(height, proposal_id):
headers = {"x-cosmos-block-height": str(height)}
else:
headers = None
# Currently EventVote only contains proposal id
# Eventually EventVote may contain proposal id and voter address
# At which point we could get the vote with this endpoint:
# /cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}
# Ref: https://github.com/regen-network/indexer/pull/38#discussion_r1310958235
resp = requests.get(
f"{os.environ['REGEN_API']}/cosmos/group/v1/votes_by_proposal/{proposal_id}",
headers=headers,
Expand Down Expand Up @@ -112,6 +117,8 @@ def _index_votes(pg_conn, _client, _chain_num):
except ForeignKeyViolation as exc:
logger.debug(exc)
pg_conn.rollback()
# since we know all votes for this proposal will fail we exit the loop
break


def index_votes():
Expand Down

0 comments on commit 633169d

Please sign in to comment.