@@ -36,22 +36,16 @@ use prometheus_endpoint::{
3636use sc_client_api:: { BlockBackend , HeaderBackend , ProofProvider } ;
3737use sc_consensus:: import_queue:: ImportQueueService ;
3838use sc_network:: {
39- config:: {
40- FullNetworkConfiguration , NonDefaultSetConfig , ProtocolId , SyncMode as SyncOperationMode ,
41- } ,
39+ config:: { FullNetworkConfiguration , NonDefaultSetConfig , ProtocolId } ,
4240 utils:: LruHashSet ,
4341 NotificationsSink , ProtocolName , ReputationChange ,
4442} ;
4543use sc_network_common:: {
4644 role:: Roles ,
4745 sync:: {
48- message:: {
49- generic:: { BlockData , BlockResponse } ,
50- BlockAnnounce , BlockAnnouncesHandshake , BlockState ,
51- } ,
46+ message:: { BlockAnnounce , BlockAnnouncesHandshake , BlockState } ,
5247 warp:: WarpSyncParams ,
5348 BadPeer , ChainSync as ChainSyncT , ExtendedPeerInfo , PollBlockAnnounceValidation , SyncEvent ,
54- SyncMode ,
5549 } ,
5650} ;
5751use sc_utils:: mpsc:: { tracing_unbounded, TracingUnboundedReceiver , TracingUnboundedSender } ;
@@ -290,12 +284,7 @@ where
290284 warp_sync_protocol_name : Option < ProtocolName > ,
291285 rx : sc_utils:: mpsc:: TracingUnboundedReceiver < sc_network:: SyncEvent < B > > ,
292286 ) -> Result < ( Self , SyncingService < B > , NonDefaultSetConfig ) , ClientError > {
293- let mode = match net_config. network_config . sync_mode {
294- SyncOperationMode :: Full => SyncMode :: Full ,
295- SyncOperationMode :: Fast { skip_proofs, storage_chain_mode } =>
296- SyncMode :: LightState { skip_proofs, storage_chain_mode } ,
297- SyncOperationMode :: Warp => SyncMode :: Warp ,
298- } ;
287+ let mode = net_config. network_config . sync_mode ;
299288 let max_parallel_downloads = net_config. network_config . max_parallel_downloads ;
300289 let max_blocks_per_request = if net_config. network_config . max_blocks_per_request >
301290 crate :: MAX_BLOCKS_IN_RESPONSE as u32
@@ -469,8 +458,8 @@ where
469458 & mut self ,
470459 validation_result : PollBlockAnnounceValidation < B :: Header > ,
471460 ) {
472- let ( header , _is_best , who ) = match validation_result {
473- PollBlockAnnounceValidation :: Skip => return ,
461+ match validation_result {
462+ PollBlockAnnounceValidation :: Skip => { } ,
474463 PollBlockAnnounceValidation :: Nothing { is_best : _, who, announce } => {
475464 self . update_peer_info ( & who) ;
476465
@@ -479,19 +468,6 @@ where
479468 self . block_announce_data_cache . put ( announce. header . hash ( ) , data) ;
480469 }
481470 }
482-
483- return
484- } ,
485- PollBlockAnnounceValidation :: ImportHeader { announce, is_best, who } => {
486- self . update_peer_info ( & who) ;
487-
488- if let Some ( data) = announce. data {
489- if !data. is_empty ( ) {
490- self . block_announce_data_cache . put ( announce. header . hash ( ) , data) ;
491- }
492- }
493-
494- ( announce. header , is_best, who)
495471 } ,
496472 PollBlockAnnounceValidation :: Failure { who, disconnect } => {
497473 if disconnect {
@@ -500,31 +476,8 @@ where
500476 }
501477
502478 self . network_service . report_peer ( who, rep:: BAD_BLOCK_ANNOUNCEMENT ) ;
503- return
504479 } ,
505- } ;
506-
507- // to import header from announced block let's construct response to request that normally
508- // would have been sent over network (but it is not in our case)
509- let blocks_to_import = self . chain_sync . on_block_data (
510- & who,
511- None ,
512- BlockResponse {
513- id : 0 ,
514- blocks : vec ! [ BlockData {
515- hash: header. hash( ) ,
516- header: Some ( header) ,
517- body: None ,
518- indexed_body: None ,
519- receipt: None ,
520- message_queue: None ,
521- justification: None ,
522- justifications: None ,
523- } ] ,
524- } ,
525- ) ;
526-
527- self . chain_sync . process_block_response_data ( blocks_to_import) ;
480+ }
528481 }
529482
530483 /// Push a block announce validation.
0 commit comments