Skip to content

Commit

Permalink
fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Dec 9, 2023
1 parent 39a0bfe commit 369ae38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions zebra-scan/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub use db::{SaplingScannedResult, SaplingScanningKey};

use self::db::ScannerWriteBatch;

/// We insert an empty results entry to the database every 1000 blocks for each stored key,
/// We insert an empty results entry to the database every this interval for each stored key,
/// so we can track progress.
const INSERT_CONTROL_INTERVAL: u32 = 1_000;

Expand Down Expand Up @@ -123,8 +123,8 @@ impl Storage {
// in a single batch.
let mut batch = ScannerWriteBatch::default();

// Every `INSERT_CONTROL_INTERVAL` we add a new control result to the scanner database so we can track progress
// made in the last interval even if no result was found.
// Every `INSERT_CONTROL_INTERVAL` we add a new entry to the scanner database for each key
// so we can track progress made in the last interval even if no transaction was yet found.
let is_control_time = height.0 % INSERT_CONTROL_INTERVAL == 0 && sapling_results.is_empty();

for (index, sapling_result) in sapling_results {
Expand All @@ -141,6 +141,7 @@ impl Storage {
batch.insert_sapling_result(self, entry);
}

// Add tracking entry for key.
if is_control_time {
batch.insert_sapling_height(self, &sapling_key, height);
}
Expand Down
4 changes: 2 additions & 2 deletions zebra-scan/src/storage/db/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ impl Storage {
let height_results = self.sapling_results_for_key_and_height(&sapling_key, height);

// If there are no results for this block, then it's a "skip up to height" marker, and
// the birthday height is the next height. If there are some results, it's the actual
// birthday height.
// the target height is the next height. If there are some results, it's the actual
// target height.
if height_results.values().all(Option::is_none) {
height = height
.next()
Expand Down

0 comments on commit 369ae38

Please sign in to comment.