@@ -2,7 +2,7 @@ use crate::Client;
22use crate :: compute_light_client_updates:: {
33 LIGHT_CLIENT_SERVER_CHANNEL_CAPACITY , compute_light_client_updates,
44} ;
5- use crate :: config:: { ClientGenesis , Config as ClientConfig } ;
5+ use crate :: config:: { ClientGenesis , Config as ClientConfig , Config } ;
66use crate :: notifier:: spawn_notifier;
77use beacon_chain:: attestation_simulator:: start_attestation_simulator_service;
88use beacon_chain:: data_availability_checker:: start_availability_cache_maintenance_service;
@@ -28,6 +28,8 @@ use execution_layer::ExecutionLayer;
2828use execution_layer:: test_utils:: generate_genesis_header;
2929use futures:: channel:: mpsc:: Receiver ;
3030use genesis:: { DEFAULT_ETH1_BLOCK_HASH , interop_genesis_state} ;
31+ use lighthouse_network:: discv5:: enr:: NodeId ;
32+ use lighthouse_network:: identity:: Keypair ;
3133use lighthouse_network:: { NetworkGlobals , prometheus_client:: registry:: Registry } ;
3234use monitoring_api:: { MonitoringHttpClient , ProcessType } ;
3335use network:: { NetworkConfig , NetworkSenders , NetworkService } ;
@@ -42,7 +44,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
4244use store:: database:: interface:: BeaconNodeBackend ;
4345use timer:: spawn_timer;
4446use tracing:: { debug, info, warn} ;
45- use types:: data_column_custody_group:: get_custody_groups_ordered;
47+ use types:: data_column_custody_group:: { CustodyIndex , get_custody_groups_ordered} ;
4648use types:: {
4749 BeaconState , BlobSidecarList , ChainSpec , EthSpec , ExecutionBlockHash , Hash256 ,
4850 SignedBeaconBlock , test_utils:: generate_deterministic_keypairs,
@@ -154,6 +156,7 @@ where
154156 mut self ,
155157 client_genesis : ClientGenesis ,
156158 config : ClientConfig ,
159+ local_keypair : Keypair ,
157160 ) -> Result < Self , String > {
158161 let store = self . store . clone ( ) ;
159162 let chain_spec = self . chain_spec . clone ( ) ;
@@ -203,6 +206,7 @@ where
203206 . event_handler ( event_handler)
204207 . execution_layer ( execution_layer)
205208 . node_custody_type ( config. chain . node_custody_type )
209+ . node_id ( NodeId :: from ( local_keypair. public ( ) ) . raw ( ) )
206210 . validator_monitor_config ( config. validator_monitor . clone ( ) )
207211 . rng ( Box :: new (
208212 StdRng :: try_from_rng ( & mut OsRng )
@@ -453,7 +457,11 @@ where
453457 }
454458
455459 /// Starts the networking stack.
456- pub async fn network ( mut self , config : Arc < NetworkConfig > ) -> Result < Self , String > {
460+ pub async fn network (
461+ mut self ,
462+ config : Arc < NetworkConfig > ,
463+ local_keypair : Keypair ,
464+ ) -> Result < Self , String > {
457465 let beacon_chain = self
458466 . beacon_chain
459467 . clone ( )
@@ -481,12 +489,11 @@ where
481489 context. executor ,
482490 libp2p_registry. as_mut ( ) ,
483491 beacon_processor_channels. beacon_processor_tx . clone ( ) ,
492+ local_keypair,
484493 )
485494 . await
486495 . map_err ( |e| format ! ( "Failed to start network: {:?}" , e) ) ?;
487496
488- init_custody_context ( beacon_chain, & network_globals) ?;
489-
490497 self . network_globals = Some ( network_globals) ;
491498 self . network_senders = Some ( network_senders) ;
492499 self . libp2p_registry = libp2p_registry;
@@ -788,21 +795,6 @@ where
788795 }
789796}
790797
791- fn init_custody_context < T : BeaconChainTypes > (
792- chain : Arc < BeaconChain < T > > ,
793- network_globals : & NetworkGlobals < T :: EthSpec > ,
794- ) -> Result < ( ) , String > {
795- let node_id = network_globals. local_enr ( ) . node_id ( ) . raw ( ) ;
796- let spec = & chain. spec ;
797- let custody_groups_ordered =
798- get_custody_groups_ordered ( node_id, spec. number_of_custody_groups , spec)
799- . map_err ( |e| format ! ( "Failed to compute custody groups: {:?}" , e) ) ?;
800- chain
801- . data_availability_checker
802- . custody_context ( )
803- . init_ordered_data_columns_from_custody_groups ( custody_groups_ordered, spec)
804- }
805-
806798impl < TSlotClock , E , THotStore , TColdStore >
807799 ClientBuilder < Witness < TSlotClock , E , THotStore , TColdStore > >
808800where
0 commit comments