Skip to content

Commit

Permalink
feat: optimize replay
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Jun 26, 2023
1 parent 2857d0a commit be26dac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/chainhook-cli/src/scan/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
cursor += 1;
blocks_scanned += 1;

if let Some(ref inscriptions_db_conn) = inscriptions_db_conn {
if !get_any_entry_in_ordinal_activities(&cursor, &inscriptions_db_conn, &ctx) {
continue;
}
}

let block_hash = retrieve_block_hash_with_retry(&cursor, &bitcoin_config, ctx).await?;
let block_breakdown =
download_and_parse_block_with_retry(&block_hash, &bitcoin_config, ctx).await?;
Expand All @@ -121,10 +127,6 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
};

if let Some(ref inscriptions_db_conn) = inscriptions_db_conn {
if !get_any_entry_in_ordinal_activities(&cursor, &inscriptions_db_conn, &ctx) {
continue;
}

// Evaluating every single block is required for also keeping track of transfers.
let local_traverals =
match find_all_inscriptions_in_block(&cursor, &inscriptions_db_conn, &ctx)
Expand Down

0 comments on commit be26dac

Please sign in to comment.