From c29cccf78e13b16ee59cec6e064a3f37acbdeeff Mon Sep 17 00:00:00 2001 From: terence tsao Date: Sat, 13 Jun 2020 11:04:04 -0700 Subject: [PATCH] Don't regen parent state for genesis state (#6237) --- beacon-chain/blockchain/service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index 80c6805e83..53062416dc 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -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 {