Skip to content

Commit

Permalink
fix(dot/network): fix justification request at head logic (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
noot authored Apr 7, 2021
1 parent 9453957 commit 98d1413
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions dot/network/sync_justification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 98d1413

Please sign in to comment.