From c68d9e92c12c0af946267b085cd898da98499582 Mon Sep 17 00:00:00 2001 From: pharr117 Date: Sat, 27 Apr 2024 14:47:11 -0400 Subject: [PATCH] Precommit --- tools/find-block-height-gaps/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/find-block-height-gaps/main.py b/tools/find-block-height-gaps/main.py index a932afc..2b4c41a 100644 --- a/tools/find-block-height-gaps/main.py +++ b/tools/find-block-height-gaps/main.py @@ -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 @@ -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],)) @@ -81,4 +81,4 @@ def flatten_and_fill(gaps): print(err) traceback.print_exc() finally: - conn.close() \ No newline at end of file + conn.close()