Move sync loop after initial resync

pull/1/head
Martin Boehm 2018-02-01 22:36:57 +01:00
parent 4bbbcb0082
commit cf15f0cf0c
1 changed files with 6 additions and 10 deletions

View File

@ -112,15 +112,16 @@ func main() {
return
}
go syncIndexLoop()
go syncMempoolLoop()
if *synchronize {
if err := resyncIndex(); err != nil {
glog.Fatal("resyncIndex ", err)
}
}
go syncIndexLoop()
go syncMempoolLoop()
chanSyncMempool <- struct{}{}
var httpServer *server.HTTPServer
if *httpServerBinding != "" {
httpServer, err = server.NewHTTPServer(*httpServerBinding, index, mempool)
@ -363,7 +364,7 @@ func resyncIndex() error {
return err
}
if chainBestHeight-startHeight > uint32(*syncChunk) {
glog.Infof("resync: parallel sync of blocks %d-%d", startHeight, chainBestHeight)
glog.Infof("resync: parallel sync of blocks %d-%d, using %d workers", startHeight, chainBestHeight, *syncWorkers)
err = connectBlocksParallel(
startHeight,
chainBestHeight,
@ -379,12 +380,7 @@ func resyncIndex() error {
}
}
err = connectBlocks(hash)
if err != nil {
return err
}
chanSyncMempool <- struct{}{}
return nil
return connectBlocks(hash)
}
func connectBlocks(