This commit is contained in:
Jared Wasinger 2025-03-17 15:40:38 +01:00
parent 788b01ac75
commit 79b08977a7

View file

@ -21,6 +21,7 @@ import (
"crypto/sha256" "crypto/sha256"
"errors" "errors"
"fmt" "fmt"
"math"
"sync" "sync"
"time" "time"
@ -126,7 +127,7 @@ func NewSimulatedBeacon(period uint64, feeRecipient common.Address, eth *eth.Eth
} }
// cap the dev mode period to a reasonable maximum value to avoid overflowing the time.Duration (int64) that it will occupy // cap the dev mode period to a reasonable maximum value to avoid overflowing the time.Duration (int64) that it will occupy
var maxPeriod uint64 = math.Floor(math.MaxInt64 / 1_000_000_000) maxPeriod := uint64(math.Floor(math.MaxInt64 / 1_000_000_000))
if period > maxPeriod { if period > maxPeriod {
log.Warn(fmt.Sprintf("period exceeds maximum possible value (have: %d, max: %d). Sanitizing period to maximum possible value.", period, maxPeriod)) log.Warn(fmt.Sprintf("period exceeds maximum possible value (have: %d, max: %d). Sanitizing period to maximum possible value.", period, maxPeriod))
period = maxPeriod period = maxPeriod