@@ -58,6 +58,7 @@ type Connection struct {
5858 onceClose sync.Once
5959 sendKeepAlives bool
6060 delayMuxerStart bool
61+ delayProtocolStart bool
6162 fullDuplex bool
6263 // Mini-protocols
6364 blockFetch * blockfetch.BlockFetch
@@ -331,6 +332,25 @@ func (c *Connection) setupConnection() error {
331332 if versionNtN .EnablePeerSharingProtocol {
332333 c .peerSharing = peersharing .New (protoOptions , c .peerSharingConfig )
333334 }
335+ // Start protocols
336+ if ! c .delayProtocolStart {
337+ if handshakeFullDuplex || ! c .server {
338+ c .blockFetch .Client .Start ()
339+ c .chainSync .Client .Start ()
340+ c .txSubmission .Client .Start ()
341+ if c .peerSharing != nil {
342+ c .peerSharing .Client .Start ()
343+ }
344+ }
345+ if handshakeFullDuplex || c .server {
346+ c .blockFetch .Server .Start ()
347+ c .chainSync .Server .Start ()
348+ c .txSubmission .Server .Start ()
349+ if c .peerSharing != nil {
350+ c .peerSharing .Server .Start ()
351+ }
352+ }
353+ }
334354 } else {
335355 versionNtC := GetProtocolVersionNtC (handshakeVersion )
336356 protoOptions .Mode = protocol .ProtocolModeNodeToClient
@@ -342,6 +362,29 @@ func (c *Connection) setupConnection() error {
342362 if versionNtC .EnableLocalTxMonitorProtocol {
343363 c .localTxMonitor = localtxmonitor .New (protoOptions , c .localTxMonitorConfig )
344364 }
365+ // Start protocols
366+ if ! c .delayProtocolStart {
367+ if handshakeFullDuplex || ! c .server {
368+ c .chainSync .Client .Start ()
369+ c .localTxSubmission .Client .Start ()
370+ if c .localStateQuery != nil {
371+ c .localStateQuery .Client .Start ()
372+ }
373+ if c .localTxMonitor != nil {
374+ c .localTxMonitor .Client .Start ()
375+ }
376+ }
377+ if handshakeFullDuplex || c .server {
378+ c .chainSync .Server .Start ()
379+ c .localTxSubmission .Server .Start ()
380+ if c .localStateQuery != nil {
381+ c .localStateQuery .Server .Start ()
382+ }
383+ if c .localTxMonitor != nil {
384+ c .localTxMonitor .Server .Start ()
385+ }
386+ }
387+ }
345388 }
346389 // Start muxer
347390 diffusionMode := muxer .DiffusionModeInitiator
0 commit comments