Skip to content

Commit 2085b20

Browse files
committed
removed fork detector and fork structs since they are no longer used after las removal
1 parent 2e85243 commit 2085b20

File tree

4 files changed

+1
-152
lines changed

4 files changed

+1
-152
lines changed

dash-spv/src/chain/fork_detector.rs

Lines changed: 0 additions & 80 deletions
This file was deleted.

dash-spv/src/chain/mod.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Chain management module with reorganization support
22
//!
33
//! This module provides functionality for managing blockchain state including:
4-
//! - Fork detection and handling
54
//! - Chain reorganization
65
//! - Multiple chain tip tracking
76
//! - Chain work calculation
@@ -11,9 +10,7 @@ pub mod chain_tip;
1110
pub mod chain_work;
1211
pub mod chainlock_manager;
1312
pub mod checkpoints;
14-
pub mod fork_detector;
1513
pub mod orphan_pool;
16-
pub mod reorg;
1714

1815
#[cfg(test)]
1916
mod checkpoint_test;
@@ -24,25 +21,4 @@ pub use chain_tip::{ChainTip, ChainTipManager};
2421
pub use chain_work::ChainWork;
2522
pub use chainlock_manager::{ChainLockEntry, ChainLockManager, ChainLockStats};
2623
pub use checkpoints::{Checkpoint, CheckpointManager};
27-
pub use fork_detector::{ForkDetectionResult, ForkDetector};
2824
pub use orphan_pool::{OrphanBlock, OrphanPool, OrphanPoolStats};
29-
pub use reorg::ReorgEvent;
30-
31-
use dashcore::{BlockHash, Header as BlockHeader};
32-
33-
/// Represents a potential chain fork
34-
#[derive(Debug, Clone)]
35-
pub struct Fork {
36-
/// The block hash where the fork diverges from the main chain
37-
pub fork_point: BlockHash,
38-
/// The height of the fork point
39-
pub fork_height: u32,
40-
/// The tip of the forked chain
41-
pub tip_hash: BlockHash,
42-
/// The height of the fork tip
43-
pub tip_height: u32,
44-
/// Headers in the fork (from fork point to tip)
45-
pub headers: Vec<BlockHeader>,
46-
/// Cumulative chain work of this fork
47-
pub chain_work: ChainWork,
48-
}

dash-spv/src/chain/reorg.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

dash-spv/src/sync/headers/manager.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use dashcore::{
77
use dashcore_hashes::Hash;
88

99
use crate::chain::checkpoints::{mainnet_checkpoints, testnet_checkpoints, CheckpointManager};
10-
use crate::chain::{ChainTip, ChainTipManager, ChainWork, ForkDetector};
10+
use crate::chain::{ChainTip, ChainTipManager, ChainWork};
1111
use crate::client::ClientConfig;
1212
use crate::error::{SyncError, SyncResult};
1313
use crate::network::NetworkManager;
@@ -47,7 +47,6 @@ pub struct HeaderSyncManager<S: StorageManager, N: NetworkManager> {
4747
_phantom_s: std::marker::PhantomData<S>,
4848
_phantom_n: std::marker::PhantomData<N>,
4949
config: ClientConfig,
50-
fork_detector: ForkDetector,
5150
tip_manager: ChainTipManager,
5251
checkpoint_manager: CheckpointManager,
5352
reorg_config: ReorgConfig,
@@ -83,8 +82,6 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
8382

8483
Ok(Self {
8584
config: config.clone(),
86-
fork_detector: ForkDetector::new(reorg_config.max_forks)
87-
.map_err(|e| SyncError::InvalidState(e.to_string()))?,
8885
tip_manager: ChainTipManager::new(reorg_config.max_forks),
8986
checkpoint_manager,
9087
reorg_config,
@@ -842,10 +839,6 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
842839
// Reset sync state
843840
self.syncing_headers = false;
844841
self.last_sync_progress = std::time::Instant::now();
845-
// Clear any fork tracking state that shouldn't persist across restarts
846-
self.fork_detector = ForkDetector::new(self.reorg_config.max_forks).map_err(|e| {
847-
SyncError::InvalidState(format!("Failed to create fork detector: {}", e))
848-
})?;
849842
tracing::debug!("Reset header sync pending requests");
850843
Ok(())
851844
}

0 commit comments

Comments
 (0)