Skip to content

Commit 98d1413

Browse files
authored
fix(dot/network): fix justification request at head logic (#1510)
1 parent 9453957 commit 98d1413

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

dot/network/sync_justification.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ func (q *syncQueue) finalizeAtHead() {
3636
return
3737
}
3838

39+
head, err := q.s.blockState.BestBlockNumber()
40+
if err != nil {
41+
continue
42+
}
43+
44+
if head.Int64() < q.goal {
45+
continue
46+
}
47+
3948
curr, err := q.s.blockState.GetFinalizedHeader(0, 0)
4049
if err != nil {
4150
continue
@@ -50,12 +59,6 @@ func (q *syncQueue) finalizeAtHead() {
5059

5160
prev = curr
5261

53-
// no new blocks have been finalized, request block justifications from peers
54-
head, err := q.s.blockState.BestBlockNumber()
55-
if err != nil {
56-
continue
57-
}
58-
5962
start := head.Uint64() - uint64(blockRequestSize)
6063
if curr.Number.Uint64() > start {
6164
start = curr.Number.Uint64() + 1

0 commit comments

Comments
 (0)