File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
node/src/transition_frontier Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -322,11 +322,6 @@ impl TransitionFrontierSyncAction {
322322 if !store. dispatch ( TransitionFrontierSyncAction :: BlocksNextApplyInit ) {
323323 store. dispatch ( TransitionFrontierSyncAction :: BlocksSuccess ) ;
324324 }
325-
326- // TODO this should be handled by a callback
327- store. dispatch ( P2pNetworkPubsubAction :: BroadcastValidatedMessage {
328- message_id : p2p:: BroadcastMessageId :: BlockHash { hash : hash. clone ( ) } ,
329- } ) ;
330325 }
331326 TransitionFrontierSyncAction :: BlocksSuccess => { }
332327 // Bootstrap/Catchup is practically complete at this point.
Original file line number Diff line number Diff line change @@ -307,10 +307,18 @@ fn synced_effects<S: crate::Service>(
307307 best_tip : best_tip. block . clone ( ) ,
308308 } ) ;
309309 }
310- // rebroadcast block if received from webrtc network, otherwise noop.
311- store. dispatch ( P2pNetworkPubsubAction :: WebRtcRebroadcast {
312- message : GossipNetMessageV2 :: NewState ( best_tip. block ( ) . clone ( ) ) ,
313- } ) ;
310+ // TODO this should be handled by a callback
311+ // If this get dispatched, we received block from libp2p.
312+ if !store. dispatch ( P2pNetworkPubsubAction :: BroadcastValidatedMessage {
313+ message_id : p2p:: BroadcastMessageId :: BlockHash {
314+ hash : best_tip. hash ( ) . clone ( ) ,
315+ } ,
316+ } ) {
317+ // Otherwise block was received from WebRTC so inject it in libp2p.
318+ store. dispatch ( P2pNetworkPubsubAction :: WebRtcRebroadcast {
319+ message : GossipNetMessageV2 :: NewState ( best_tip. block ( ) . clone ( ) ) ,
320+ } ) ;
321+ }
314322
315323 let best_tip_hash = best_tip. merkle_root_hash ( ) . clone ( ) ;
316324 store. dispatch ( ConsensusAction :: Prune ) ;
You can’t perform that action at this time.
0 commit comments