Skip to content

Commit

Permalink
Merge pull request mempool#66 from mempool/junderw/periodic_log_progress
Browse files Browse the repository at this point in the history
Feature: Log every 10k blocks to help show progress during initial sync
  • Loading branch information
wiz authored Dec 15, 2023
2 parents 1347673 + 35effe4 commit 39f42c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/new_index/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,12 @@ impl Indexer {
.added_blockhashes
.write()
.unwrap()
.extend(blocks.iter().map(|b| b.entry.hash()));
.extend(blocks.iter().map(|b| {
if b.entry.height() % 10_000 == 0 {
info!("Tx indexing is up to height={}", b.entry.height());
}
b.entry.hash()
}));
}

fn index(&self, blocks: &[BlockEntry]) {
Expand All @@ -342,6 +347,9 @@ impl Indexer {
let _timer = self.start_timer("index_process");
let added_blockhashes = self.store.added_blockhashes.read().unwrap();
for b in blocks {
if b.entry.height() % 10_000 == 0 {
info!("History indexing is up to height={}", b.entry.height());
}
let blockhash = b.entry.hash();
// TODO: replace by lookup into txstore_db?
if !added_blockhashes.contains(blockhash) {
Expand Down

0 comments on commit 39f42c7

Please sign in to comment.