Skip to content

Commit

Permalink
Merge branch 'fix_reorg_and_improve_continuity_checks' into fixed_out…
Browse files Browse the repository at this point in the history
…put_batching
  • Loading branch information
Oscar-Pepper committed Jan 16, 2025
2 parents c9b898b + 5c34d84 commit 4f42071
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions zingo-sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ where
.fold(0, |acc, block_range| {
acc + (block_range.end - block_range.start)
});
let scanned_blocks = sync_state.initial_sync_state().total_blocks_to_scan() - unscanned_blocks;
let scanned_blocks = sync_state
.initial_sync_state()
.total_blocks_to_scan()
.saturating_sub(unscanned_blocks);
let percentage_blocks_scanned = (scanned_blocks as f32
/ sync_state.initial_sync_state().total_blocks_to_scan() as f32)
* 100.0;
Expand All @@ -228,11 +231,11 @@ where
let scanned_sapling_outputs = sync_state
.initial_sync_state()
.total_sapling_outputs_to_scan()
- unscanned_sapling_outputs;
.saturating_sub(unscanned_sapling_outputs);
let scanned_orchard_outputs = sync_state
.initial_sync_state()
.total_orchard_outputs_to_scan()
- unscanned_orchard_outputs;
.saturating_sub(unscanned_orchard_outputs);
let percentage_outputs_scanned = ((scanned_sapling_outputs + scanned_orchard_outputs) as f32
/ (sync_state
.initial_sync_state()
Expand Down
2 changes: 1 addition & 1 deletion zingo-sync/src/sync/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ where
.activation_height(NetworkUpgrade::Sapling)
.expect("should have some sapling activation height");

match block_height.cmp(&sapling_activation_height) {
match block_height.cmp(&(sapling_activation_height - 1)) {
cmp::Ordering::Greater => {
let frontiers = client::get_frontiers(fetch_request_sender.clone(), block_height)
.await
Expand Down

0 comments on commit 4f42071

Please sign in to comment.