Skip to content

Commit 6fe9408

Browse files
authored
chore: remove unused ChainLockStats (#281)
1 parent 76578c0 commit 6fe9408

File tree

3 files changed

+1
-58
lines changed

3 files changed

+1
-58
lines changed

dash-spv/src/chain/chainlock_manager.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -443,59 +443,8 @@ impl ChainLockManager {
443443
}
444444
}
445445
}
446-
447446
Ok(chain_locks)
448447
}
449-
450-
/// Get chain lock statistics
451-
pub fn get_stats(&self) -> ChainLockStats {
452-
let by_height = match self.chain_locks_by_height.read() {
453-
Ok(guard) => guard,
454-
Err(_) => {
455-
return ChainLockStats {
456-
total_chain_locks: 0,
457-
cached_by_height: 0,
458-
cached_by_hash: 0,
459-
highest_locked_height: None,
460-
lowest_locked_height: None,
461-
enforce_chain_locks: self.enforce_chain_locks,
462-
}
463-
}
464-
};
465-
let by_hash = match self.chain_locks_by_hash.read() {
466-
Ok(guard) => guard,
467-
Err(_) => {
468-
return ChainLockStats {
469-
total_chain_locks: 0,
470-
cached_by_height: 0,
471-
cached_by_hash: 0,
472-
highest_locked_height: None,
473-
lowest_locked_height: None,
474-
enforce_chain_locks: self.enforce_chain_locks,
475-
}
476-
}
477-
};
478-
479-
ChainLockStats {
480-
total_chain_locks: by_height.len(),
481-
cached_by_height: by_height.len(),
482-
cached_by_hash: by_hash.len(),
483-
highest_locked_height: by_height.keys().max().cloned(),
484-
lowest_locked_height: by_height.keys().min().cloned(),
485-
enforce_chain_locks: self.enforce_chain_locks,
486-
}
487-
}
488-
}
489-
490-
/// Chain lock statistics
491-
#[derive(Debug, Clone)]
492-
pub struct ChainLockStats {
493-
pub total_chain_locks: usize,
494-
pub cached_by_height: usize,
495-
pub cached_by_hash: usize,
496-
pub highest_locked_height: Option<u32>,
497-
pub lowest_locked_height: Option<u32>,
498-
pub enforce_chain_locks: bool,
499448
}
500449

501450
#[cfg(test)]

dash-spv/src/chain/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod reorg_test;
2323

2424
pub use chain_tip::{ChainTip, ChainTipManager};
2525
pub use chain_work::ChainWork;
26-
pub use chainlock_manager::{ChainLockEntry, ChainLockManager, ChainLockStats};
26+
pub use chainlock_manager::{ChainLockEntry, ChainLockManager};
2727
pub use checkpoints::{Checkpoint, CheckpointManager};
2828
pub use fork_detector::{ForkDetectionResult, ForkDetector};
2929
pub use reorg::{ReorgEvent, ReorgManager};

dash-spv/tests/chainlock_validation_test.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,6 @@ async fn test_chainlock_manager_cache_operations() {
312312
let entry_by_hash = chainlock_manager.get_chain_lock_by_hash(&genesis.block_hash());
313313
assert!(entry_by_hash.is_some());
314314
assert_eq!(entry_by_hash.unwrap().chain_lock.block_height, 0);
315-
316-
// Check stats
317-
let stats = chainlock_manager.get_stats();
318-
assert!(stats.total_chain_locks > 0);
319-
assert_eq!(stats.highest_locked_height, Some(0));
320-
assert_eq!(stats.lowest_locked_height, Some(0));
321315
}
322316

323317
#[ignore = "mock implementation incomplete"]

0 commit comments

Comments
 (0)