check db for justified state (#4905)

This commit is contained in:
Nishant Das 2020-02-19 22:18:44 +08:00 committed by GitHub
parent 8e55c81bd5
commit 641ad51dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -267,6 +267,9 @@ func (s *Service) updateJustified(ctx context.Context, state *stateTrie.BeaconSt
// If justified state is nil, resume back to normal syncing process and save
// justified check point.
if justifiedState == nil {
if s.beaconDB.HasState(ctx, justifiedRoot) {
return s.beaconDB.SaveJustifiedCheckpoint(ctx, cpt)
}
justifiedState, err = s.generateState(ctx, bytesutil.ToBytes32(s.finalizedCheckpt.Root), justifiedRoot)
if err != nil {
log.Error(err)