Skip to content

Commit

Permalink
Don't regen parent state for genesis state (#6237)
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed Jun 13, 2020
1 parent 298955c commit c29cccf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions beacon-chain/blockchain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,10 @@ func (s *Service) initializeChainInfo(ctx context.Context) error {
return errors.Wrap(err, "could not get finalized block from db")
}

if featureconfig.Get().NewStateMgmt && featureconfig.Get().SkipRegenHistoricalStates {
// To skip the regeneration of historical state, the node has to generate the parent of the last finalized state.
// To skip the regeneration of historical state, the node has to generate the parent of the last finalized state.
// We don't need to do this for genesis.
atGenesis := s.CurrentSlot() == 0
if featureconfig.Get().NewStateMgmt && featureconfig.Get().SkipRegenHistoricalStates && !atGenesis {
parentRoot := bytesutil.ToBytes32(finalizedBlock.Block.ParentRoot)
parentState, err := s.generateState(ctx, finalizedRoot, parentRoot)
if err != nil {
Expand Down

0 comments on commit c29cccf

Please sign in to comment.