test: avoid evidenceFraction parameter to be very close to 1.0 (#16978)

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Marko <marko@baricevic.me>
This commit is contained in:
Gustavo Grieco 2023-08-29 12:50:46 +02:00 committed by GitHub
parent 79cc75b1db
commit aabcfb2aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,6 +184,12 @@ func RandomRequestFinalizeBlock(
// TODO: Determine capacity before allocation
evidence := make([]abci.Misbehavior, 0)
// If the evidenceFraction value is to close to 1.0,
// the following loop will most likely never end
if params.EvidenceFraction() > 0.9 {
// Reduce the evidenceFraction to a more sane value
params.evidenceFraction = 0.9
}
for r.Float64() < params.EvidenceFraction() {
vals := voteInfos