network: move service starts to tryStartServices

All of them only make sense on a fully synchronized node, doing anything
during the initial sync is just a waste of time.
This commit is contained in:
Roman Khimov 2021-04-02 13:12:06 +03:00
parent 690a1db589
commit 99b71bbbd1

View file

@ -265,16 +265,6 @@ func (s *Server) Start(errChan chan error) {
s.initStaleMemPools()
go s.broadcastTxLoop()
if s.oracle != nil {
go s.oracle.Run()
}
if s.notaryModule != nil {
s.notaryRequestPool.RunSubscriptions()
go s.notaryModule.Run()
}
if s.StateRootCfg.Enabled {
s.stateRoot.Run()
}
go s.relayBlocksLoop()
go s.bQueue.run()
go s.transport.Accept()
@ -449,6 +439,16 @@ func (s *Server) tryStartServices() {
if s.Wallet != nil {
s.consensus.Start()
}
if s.StateRootCfg.Enabled {
s.stateRoot.Run()
}
if s.oracle != nil {
go s.oracle.Run()
}
if s.notaryModule != nil {
s.notaryRequestPool.RunSubscriptions()
go s.notaryModule.Run()
}
}
}