From cf15f0cf0cdfd363a75e741e773b3fceae81ef1a Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Thu, 1 Feb 2018 22:36:57 +0100 Subject: [PATCH] Move sync loop after initial resync --- blockbook.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/blockbook.go b/blockbook.go index ae668ab2..f9d0ce8b 100644 --- a/blockbook.go +++ b/blockbook.go @@ -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(