Skip to content

Commit

Permalink
Precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
pharr117 committed Apr 27, 2024
1 parent e1c4a7c commit c68d9e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/find-block-height-gaps/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def get_args():

SELECT_CHAINS_QUERY = "SELECT id FROM chains WHERE chain_id=%s;"
GAPS_QUERY = """
SELECT height + 1 AS gap_start,
SELECT height + 1 AS gap_start,
next_height - 1 AS gap_end
FROM (
SELECT height,
SELECT height,
LEAD(height) OVER (ORDER BY height) AS next_height
FROM blocks WHERE blockchain_id = %s
) nr
Expand Down Expand Up @@ -62,7 +62,7 @@ def flatten_and_fill(gaps):
rec = cur.fetchone()
if rec is None:
raise Exception(f"Chain ID {chain_id} not found")

print("Executing gap finder...")
with conn.cursor() as cur:
cur.execute(GAPS_QUERY, (rec[0],))
Expand All @@ -81,4 +81,4 @@ def flatten_and_fill(gaps):
print(err)
traceback.print_exc()
finally:
conn.close()
conn.close()

0 comments on commit c68d9e9

Please sign in to comment.