33//! Each chain type is stored in it's own map. A variety of helper functions are given along with 
44//! this struct to simplify the logic of the other layers of sync. 
55
6- use  super :: block_storage:: BlockStorage ; 
76use  super :: chain:: { ChainId ,  ProcessingResult ,  RemoveChain ,  SyncingChain } ; 
87use  super :: sync_type:: RangeSyncType ; 
98use  crate :: metrics; 
109use  crate :: sync:: network_context:: SyncNetworkContext ; 
11- use  beacon_chain:: BeaconChainTypes ; 
10+ use  beacon_chain:: { BeaconChain ,   BeaconChainTypes } ; 
1211use  fnv:: FnvHashMap ; 
1312use  lighthouse_network:: PeerId ; 
1413use  lighthouse_network:: SyncInfo ; 
@@ -37,10 +36,13 @@ pub enum RangeSyncState {
3736Idle , 
3837} 
3938
39+ pub  type  SyncChainStatus  =
40+     Result < Option < ( RangeSyncType ,  Slot  /* from */ ,  Slot  /* to */ ) > ,  & ' static  str > ; 
41+ 
4042/// A collection of finalized and head chains currently being processed. 
41- pub  struct  ChainCollection < T :  BeaconChainTypes ,   C >  { 
43+ pub  struct  ChainCollection < T :  BeaconChainTypes >  { 
4244    /// The beacon chain for processing. 
43- beacon_chain :  Arc < C > , 
45+ beacon_chain :  Arc < BeaconChain < T > > , 
4446    /// The set of finalized chains being synced. 
4547finalized_chains :  FnvHashMap < ChainId ,  SyncingChain < T > > , 
4648    /// The set of head chains being synced. 
@@ -51,8 +53,8 @@ pub struct ChainCollection<T: BeaconChainTypes, C> {
5153log :  slog:: Logger , 
5254} 
5355
54- impl < T :  BeaconChainTypes ,   C :   BlockStorage >  ChainCollection < T ,   C >  { 
55-     pub  fn  new ( beacon_chain :  Arc < C > ,  log :  slog:: Logger )  -> Self  { 
56+ impl < T :  BeaconChainTypes >  ChainCollection < T >  { 
57+     pub  fn  new ( beacon_chain :  Arc < BeaconChain < T > > ,  log :  slog:: Logger )  -> Self  { 
5658        ChainCollection  { 
5759            beacon_chain, 
5860            finalized_chains :  FnvHashMap :: default ( ) , 
@@ -213,9 +215,7 @@ impl<T: BeaconChainTypes, C: BlockStorage> ChainCollection<T, C> {
213215        } 
214216    } 
215217
216-     pub  fn  state ( 
217-         & self , 
218-     )  -> Result < Option < ( RangeSyncType ,  Slot  /* from */ ,  Slot  /* to */ ) > ,  & ' static  str >  { 
218+     pub  fn  state ( & self )  -> SyncChainStatus  { 
219219        match  self . state  { 
220220            RangeSyncState :: Finalized ( ref  syncing_id)  => { 
221221                let  chain = self 
@@ -409,7 +409,8 @@ impl<T: BeaconChainTypes, C: BlockStorage> ChainCollection<T, C> {
409409        let  log_ref = & self . log ; 
410410
411411        let  is_outdated = |target_slot :  & Slot ,  target_root :  & Hash256 | { 
412-             target_slot <= & local_finalized_slot || beacon_chain. is_block_known ( target_root) 
412+             target_slot <= & local_finalized_slot
413+                 || beacon_chain. block_is_known_to_fork_choice ( target_root) 
413414        } ; 
414415
415416        // Retain only head peers that remain relevant 
0 commit comments