blocksync: code refactoring and bug fix

This commit is contained in:
Jasmina Malicevic
2022-05-13 13:59:01 +02:00
parent f776b6cea0
commit 9dc425f2fa
3 changed files with 68 additions and 65 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ func (pool *BlockPool) PopRequest() {
// to smooth the block sync rate and the unit represents the number of blocks per second.
// -1 because the start height is assumed to be 1 @jmalicevic ToDo, verify it is still OK when
// starting height is not 1
if (pool.height-pool.startHeight)%100 == 0 && pool.height != pool.startHeight {
if (pool.height-pool.startHeight-1)%100 == 0 && pool.height != pool.startHeight {
newSyncRate := 100 / time.Since(pool.lastHundredBlockTimeStamp).Seconds()
if pool.lastSyncRate == 0 {
pool.lastSyncRate = newSyncRate