core: init genesis block header if there are no other headers in DB
Fixes crash when restarted after the DB initialization and no blocks written into the DB.
This commit is contained in:
parent
c16c2bf102
commit
b5199625cd
1 changed files with 3 additions and 0 deletions
|
@ -135,6 +135,9 @@ func (bc *Blockchain) init() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if bc.storedHeaderCount == 0 && currHeaderHeight == 0 {
|
||||
bc.headerList.Add(currHeaderHash)
|
||||
}
|
||||
|
||||
// There is a high chance that the Node is stopped before the next
|
||||
// batch of 2000 headers was stored. Via the currentHeaders stored we can sync
|
||||
|
|
Loading…
Reference in a new issue