Skip to content

Commit eccfb9c

Browse files
Reverse branches to improve clarity
1 parent 7048d4e commit eccfb9c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

module/fork_spec.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,12 @@ func estimateDistance(previousHeader, currentHeader *types.Header, targetTs uint
366366

367367
avgBlocksPerMs := blockCountPrevCur / float64(timeDiffPrevCur)
368368

369-
if avgBlocksPerMs <= 0 {
370-
// Blocks are being produced so slowly that the current block is still expected
371-
// to be the latest block at any future timestamp. Return 1 to avoid getting stuck
372-
// in the current block.
373-
return 1
369+
if avgBlocksPerMs > 0 {
370+
return uint64(math.Ceil(avgBlocksPerMs * float64(timeDiffTargetCur)))
374371
}
375372

376-
return uint64(math.Ceil(avgBlocksPerMs * float64(timeDiffTargetCur)))
373+
// Blocks are being produced so slowly that the current block is still expected
374+
// to be the latest block at any future timestamp. Return 1 to avoid getting stuck
375+
// in the current block.
376+
return 1
377377
}

0 commit comments

Comments
 (0)