les: recover stable checkpoint if nil

This commit is contained in:
rjl493456442 2018-07-30 13:18:15 +08:00
parent ca0ac58f18
commit 90366b3bb7

View file

@ -276,6 +276,9 @@ func (s *LesServer) checkpointLoop(checkpoint *light.TrustedCheckpoint) (err err
if number < light.CheckpointConfirmations+light.CheckpointFrequency {
continue
}
if checkpoint == nil {
checkpoint = s.recoverCheckpoint()
}
idx := (number-light.CheckpointConfirmations)/light.CheckpointFrequency - 1
if checkpoint == nil || idx > checkpoint.SectionIdx {
hash, ok := announcement[idx]