refactor: replace math.Min and math.Max with built-in min/max

Reference: https://github.com/lightningnetwork/lnd/pull/9451#pullrequestreview-2580942691
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2025-01-30 23:55:23 +08:00
parent 0899cee987
commit e56a7945be
4 changed files with 6 additions and 21 deletions

View File

@@ -183,7 +183,7 @@ func randRetryDelay(initialRetryDelay, maxRetryDelay time.Duration,
// attempt. If we double something n times, that's the same as
// multiplying the value with 2^n. We limit the power to 32 to avoid
// overflows.
factor := time.Duration(math.Pow(2, math.Min(float64(attempt), 32)))
factor := time.Duration(math.Pow(2, min(float64(attempt), 32)))
actualDelay := initialDelay * factor
// Cap the delay at the maximum configured value.