asserts non-nil state (#5115)

This commit is contained in:
Victor Farazdagi 2020-03-17 17:58:16 +03:00 committed by GitHub
parent e529f5b1d6
commit e96b45b29c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,9 +126,6 @@ func (s *Service) saveHeadNoDB(ctx context.Context, b *ethpb.SignedBeaconBlock,
if err != nil {
return errors.Wrap(err, "could not retrieve head state in DB")
}
if headState == nil {
return errors.New("nil head state")
}
} else {
headState, err = s.beaconDB.State(ctx, r)
if err != nil {
@ -143,6 +140,9 @@ func (s *Service) saveHeadNoDB(ctx context.Context, b *ethpb.SignedBeaconBlock,
s.initSyncStateLock.RUnlock()
}
}
if headState == nil {
return errors.New("nil head state")
}
s.setHead(r, stateTrie.CopySignedBeaconBlock(b), headState)