VDB-302 Sleep when no missing blocks in lightSync (#129)

* Sleep when no missing blocks in lightSync

* Fix tests and error propagation

* Correct geth.log to logrus
This commit is contained in:
Edvard Hübinette
2019-01-11 10:58:41 +01:00
committed by GitHub
parent 77209d3b62
commit ebca338b1e
9 changed files with 83 additions and 30 deletions
+8 -2
View File
@@ -81,9 +81,15 @@ func lightSync() {
for {
select {
case <-ticker.C:
window := validator.ValidateHeaders()
window, err := validator.ValidateHeaders()
if err != nil {
log.Error("ValidateHeaders failed in lightSync: ", err)
}
window.Log(os.Stdout)
case <-missingBlocksPopulated:
case n := <-missingBlocksPopulated:
if n == 0 {
time.Sleep(3 * time.Second)
}
go backFillAllHeaders(blockChain, headerRepository, missingBlocksPopulated, startingBlockNumber)
}
}