mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
eth/catalyst: sanitize simulated beacon period to avoid overflowing the time.Duration it will occupy
This commit is contained in:
parent
1cdf4d6da7
commit
87d35f0045
1 changed files with 8 additions and 0 deletions
|
|
@ -124,6 +124,14 @@ func NewSimulatedBeacon(period uint64, feeRecipient common.Address, eth *eth.Eth
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// cap the dev mode period to a reasonable maximum value to avoid overflowing the time.Duration (int64) that it will occupy
|
||||
var maxPeriod uint64 = 9223372036 // math.Floor(math.MaxInt64 / 1000000000)
|
||||
if 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
|
||||
}
|
||||
|
||||
return &SimulatedBeacon{
|
||||
eth: eth,
|
||||
period: period,
|
||||
|
|
|
|||
Loading…
Reference in a new issue