Move sync loop after initial resync
This commit is contained in:
parent
4bbbcb0082
commit
cf15f0cf0c
16
blockbook.go
16
blockbook.go
@ -112,15 +112,16 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
go syncIndexLoop()
|
|
||||||
go syncMempoolLoop()
|
|
||||||
|
|
||||||
if *synchronize {
|
if *synchronize {
|
||||||
if err := resyncIndex(); err != nil {
|
if err := resyncIndex(); err != nil {
|
||||||
glog.Fatal("resyncIndex ", err)
|
glog.Fatal("resyncIndex ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go syncIndexLoop()
|
||||||
|
go syncMempoolLoop()
|
||||||
|
chanSyncMempool <- struct{}{}
|
||||||
|
|
||||||
var httpServer *server.HTTPServer
|
var httpServer *server.HTTPServer
|
||||||
if *httpServerBinding != "" {
|
if *httpServerBinding != "" {
|
||||||
httpServer, err = server.NewHTTPServer(*httpServerBinding, index, mempool)
|
httpServer, err = server.NewHTTPServer(*httpServerBinding, index, mempool)
|
||||||
@ -363,7 +364,7 @@ func resyncIndex() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if chainBestHeight-startHeight > uint32(*syncChunk) {
|
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(
|
err = connectBlocksParallel(
|
||||||
startHeight,
|
startHeight,
|
||||||
chainBestHeight,
|
chainBestHeight,
|
||||||
@ -379,12 +380,7 @@ func resyncIndex() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = connectBlocks(hash)
|
return connectBlocks(hash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
chanSyncMempool <- struct{}{}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectBlocks(
|
func connectBlocks(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user