diff --git a/dot/network/sync_justification.go b/dot/network/sync_justification.go index c5310cc144..e0897d0d10 100644 --- a/dot/network/sync_justification.go +++ b/dot/network/sync_justification.go @@ -36,6 +36,15 @@ func (q *syncQueue) finalizeAtHead() { return } + head, err := q.s.blockState.BestBlockNumber() + if err != nil { + continue + } + + if head.Int64() < q.goal { + continue + } + curr, err := q.s.blockState.GetFinalizedHeader(0, 0) if err != nil { continue @@ -50,12 +59,6 @@ func (q *syncQueue) finalizeAtHead() { prev = curr - // no new blocks have been finalized, request block justifications from peers - head, err := q.s.blockState.BestBlockNumber() - if err != nil { - continue - } - start := head.Uint64() - uint64(blockRequestSize) if curr.Number.Uint64() > start { start = curr.Number.Uint64() + 1