eth: fix panic in randomDuration when min equals max (#33193)

Fixes a potential panic in `randomDuration` when `min == max` by
handling the edge case explicitly.
This commit is contained in:
maradini77 2025-11-18 18:54:53 +01:00 committed by Alvarez
parent 6f44b29696
commit 05c26af90f

View file

@ -145,6 +145,9 @@ func randomDuration(min, max time.Duration) time.Duration {
if min > max {
panic("min duration must be less than or equal to max duration")
}
if min == max {
return min
}
return time.Duration(mrand.Int63n(int64(max-min)) + int64(min))
}