This commit is contained in:
Łukasz Magiera 2020-08-29 02:13:38 +02:00
parent 9d0c8ae3dd
commit a62e44c4e5

View File

@ -37,6 +37,10 @@ func ValidateBlockValues(b RandomBeacon, h *types.BlockHeader, prevEntry types.B
return nil return nil
} }
if len(h.BeaconEntries) == 0 {
return xerrors.Errorf("expected to have beacon entries in this block, but didn't find any")
}
last := h.BeaconEntries[len(h.BeaconEntries)-1] last := h.BeaconEntries[len(h.BeaconEntries)-1]
if last.Round != maxRound { if last.Round != maxRound {
return xerrors.Errorf("expected final beacon entry in block to be at round %d, got %d", maxRound, last.Round) return xerrors.Errorf("expected final beacon entry in block to be at round %d, got %d", maxRound, last.Round)