1- //! Header synchronization with reorganization support
2- //!
3- //! This module extends the basic header sync with fork detection and reorg handling.
1+ //! Header synchronization with fork detection and reorganization handling.
42
53use dashcore:: {
64 block:: { Header as BlockHeader , Version } ,
@@ -45,8 +43,8 @@ impl Default for ReorgConfig {
4543 }
4644}
4745
48- /// Manages header synchronization with reorg support
49- pub struct HeaderSyncManagerWithReorg < S : StorageManager , N : NetworkManager > {
46+ /// Manages header synchronization with fork detection and reorganization support
47+ pub struct HeaderSyncManager < S : StorageManager , N : NetworkManager > {
5048 _phantom_s : std:: marker:: PhantomData < S > ,
5149 _phantom_n : std:: marker:: PhantomData < N > ,
5250 config : ClientConfig ,
@@ -67,9 +65,9 @@ pub struct HeaderSyncManagerWithReorg<S: StorageManager, N: NetworkManager> {
6765}
6866
6967impl < S : StorageManager + Send + Sync + ' static , N : NetworkManager + Send + Sync + ' static >
70- HeaderSyncManagerWithReorg < S , N >
68+ HeaderSyncManager < S , N >
7169{
72- /// Create a new header sync manager with reorg support
70+ /// Create a new header sync manager
7371 pub fn new (
7472 config : & ClientConfig ,
7573 reorg_config : ReorgConfig ,
@@ -229,14 +227,14 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
229227 Ok ( loaded_count)
230228 }
231229
232- /// Handle a Headers message with fork detection and reorg support
230+ /// Handle a Headers message
233231 pub async fn handle_headers_message (
234232 & mut self ,
235233 headers : Vec < BlockHeader > ,
236234 storage : & mut S ,
237235 network : & mut N ,
238236 ) -> SyncResult < bool > {
239- tracing:: info!( "🔍 Handle headers message with {} headers (reorg-aware) " , headers. len( ) ) ;
237+ tracing:: info!( "🔍 Handle headers message with {} headers" , headers. len( ) ) ;
240238
241239 // Step 1: Handle Empty Batch
242240 if headers. is_empty ( ) {
@@ -656,7 +654,7 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
656654 return Err ( SyncError :: SyncInProgress ) ;
657655 }
658656
659- tracing:: info!( "Preparing header synchronization with reorg support " ) ;
657+ tracing:: info!( "Preparing header synchronization" ) ;
660658 tracing:: info!(
661659 "Chain state before prepare_sync: sync_base_height={}, synced_from_checkpoint={}, headers_count={}" ,
662660 self . get_sync_base_height( ) ,
@@ -804,7 +802,7 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
804802 self . syncing_headers = true ;
805803 self . last_sync_progress = std:: time:: Instant :: now ( ) ;
806804 tracing:: info!(
807- "✅ Prepared header sync state with reorg support , ready to request headers from {:?}" ,
805+ "✅ Prepared header sync state, ready to request headers from {:?}" ,
808806 base_hash
809807 ) ;
810808
@@ -813,7 +811,7 @@ impl<S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + Sync
813811
814812 /// Start synchronizing headers (initialize the sync state).
815813 pub async fn start_sync ( & mut self , network : & mut N , storage : & mut S ) -> SyncResult < bool > {
816- tracing:: info!( "Starting header synchronization with reorg support " ) ;
814+ tracing:: info!( "Starting header synchronization" ) ;
817815
818816 // Prepare sync state (this will check if sync is already in progress)
819817 let base_hash = self . prepare_sync ( storage) . await ?;
0 commit comments