Skip to content

Commit

Permalink
Prevent blockupdates from blocking initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Roberts committed Jan 21, 2022
1 parent 3e7f0d9 commit 92c1f27
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/blockupdates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,15 @@ func AppendAncient(number uint64, hash, headerBytes, body, receipts, td []byte)
log.Warn("Could not decode ancient header", "block", number)
return
}
for backend == nil {
time.Sleep(250 * time.Millisecond)
}
backend.ChainDb().Delete(append([]byte("su"), header.Root.Bytes()...))
go func() {
// Background this so we can clean up once the backend is set, but we don't
// block the creation of the backend.
for backend == nil {
time.Sleep(250 * time.Millisecond)
}
backend.ChainDb().Delete(append([]byte("su"), header.Root.Bytes()...))
}()

}

// NewHead is invoked when a new block becomes the latest recognized block. We
Expand Down

0 comments on commit 92c1f27

Please sign in to comment.