mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 06:33:16 +00:00
evidence: cap evidence to an absolute number (#4780)
The number of evidence that can be committed in a single block is capped by a new evidence parameter called MaxNum
This commit is contained in:
@@ -120,11 +120,10 @@ func validateBlock(evidencePool EvidencePool, stateDB dbm.DB, state State, block
|
||||
}
|
||||
|
||||
// Limit the amount of evidence
|
||||
maxNumEvidence, _ := types.MaxEvidencePerBlock(state.ConsensusParams.Block.MaxBytes)
|
||||
numEvidence := int64(len(block.Evidence.Evidence))
|
||||
if numEvidence > maxNumEvidence {
|
||||
return types.NewErrEvidenceOverflow(maxNumEvidence, numEvidence)
|
||||
|
||||
numEvidence := len(block.Evidence.Evidence)
|
||||
// MaxNumEvidence is capped at uint16, so conversion is always safe.
|
||||
if maxEvidence := int(state.ConsensusParams.Evidence.MaxNum); numEvidence > maxEvidence {
|
||||
return types.NewErrEvidenceOverflow(maxEvidence, numEvidence)
|
||||
}
|
||||
|
||||
// Validate all evidence.
|
||||
|
||||
Reference in New Issue
Block a user