mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 21:01:21 +00:00
state.VerifyEvidence enforces EvidenceParams.MaxAge
This commit is contained in:
@ -389,6 +389,13 @@ func (s *State) GetValidators() (last *types.ValidatorSet, current *types.Valida
|
||||
// NOTE: return error may be ErrNoValSetForHeight, in which case the validator set
|
||||
// for the evidence height could not be loaded.
|
||||
func (s *State) VerifyEvidence(evidence types.Evidence) (priority int, err error) {
|
||||
evidenceAge := s.LastBlockHeight - evidence.Height()
|
||||
maxAge := s.Params.EvidenceParams.MaxAge
|
||||
if evidenceAge > maxAge {
|
||||
return priority, fmt.Errorf("Evidence from height %d is too old. Min height is %d",
|
||||
evidence.Height(), s.LastBlockHeight-maxAge)
|
||||
}
|
||||
|
||||
if err := evidence.Verify(s.ChainID); err != nil {
|
||||
return priority, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user