Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Remove is_skipped() and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Czabaniuk committed Nov 7, 2023
1 parent a2c49c1 commit 4bd6503
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,6 @@ impl Blockstore {
.unwrap_or(0)
}

fn min_root(&self) -> Slot {
self.rooted_slot_iterator(0)
.ok()
.and_then(|mut iter| iter.next())
.unwrap_or_default()
}

pub fn slot_meta_iterator(
&self,
slot: Slot,
Expand Down Expand Up @@ -3111,17 +3104,6 @@ impl Blockstore {
matches!(self.db.get::<cf::Root>(slot), Ok(Some(true)))
}

/// Returns true if a slot is between the rooted slot bounds of the ledger, but has not itself
/// been rooted. This is either because the slot was skipped, or due to a gap in ledger data,
/// as when booting from a newer snapshot.
pub fn is_skipped(&self, slot: Slot) -> bool {
if self.is_root(slot) {
false
} else {
slot > self.min_root() && slot < self.max_root()
}
}

pub fn insert_bank_hash(&self, slot: Slot, frozen_hash: Hash, is_duplicate_confirmed: bool) {
if let Some(prev_value) = self.bank_hash_cf.get(slot).unwrap() {
if prev_value.frozen_hash() == frozen_hash && prev_value.is_duplicate_confirmed() {
Expand Down Expand Up @@ -6871,22 +6853,6 @@ pub mod tests {
}
}

#[test]
fn test_is_skipped() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let roots = [2, 4, 7, 12, 15];
blockstore.set_roots(roots.iter()).unwrap();

for i in 0..20 {
if i < 2 || roots.contains(&i) || i > 15 {
assert!(!blockstore.is_skipped(i));
} else {
assert!(blockstore.is_skipped(i));
}
}
}

#[test]
fn test_iter_bounds() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
Expand Down

0 comments on commit 4bd6503

Please sign in to comment.