forked from TrueCloudLab/neoneo-go
core: initialize headers before current block
This commit is contained in:
parent
0e0b55350a
commit
5cda24b3af
1 changed files with 10 additions and 10 deletions
|
@ -310,16 +310,6 @@ func (bc *Blockchain) init() error {
|
|||
// and the genesis block as first block.
|
||||
bc.log.Info("restoring blockchain", zap.String("version", version))
|
||||
|
||||
bHeight, err := bc.dao.GetCurrentBlockHeight()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bc.blockHeight = bHeight
|
||||
bc.persistedHeight = bHeight
|
||||
if err = bc.stateRoot.Init(bHeight, bc.config.KeepOnlyLatestState); err != nil {
|
||||
return fmt.Errorf("can't init MPT at height %d: %w", bHeight, err)
|
||||
}
|
||||
|
||||
bc.headerHashes, err = bc.dao.GetHeaderHashes()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -367,6 +357,16 @@ func (bc *Blockchain) init() error {
|
|||
}
|
||||
}
|
||||
|
||||
bHeight, err := bc.dao.GetCurrentBlockHeight()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bc.blockHeight = bHeight
|
||||
bc.persistedHeight = bHeight
|
||||
if err = bc.stateRoot.Init(bHeight, bc.config.KeepOnlyLatestState); err != nil {
|
||||
return fmt.Errorf("can't init MPT at height %d: %w", bHeight, err)
|
||||
}
|
||||
|
||||
err = bc.contracts.NEO.InitializeCache(bc, bc.dao)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't init cache for NEO native contract: %w", err)
|
||||
|
|
Loading…
Reference in a new issue