0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

refactor: Remove not needed std::max

This commit is contained in:
MacroFake 2022-07-26 11:10:03 +02:00
parent 5057adf22f
commit fa9284c3e9
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -89,11 +89,11 @@ bool AddrInfo::IsTerrible(int64_t nNow) const
double AddrInfo::GetChance(int64_t nNow) const
{
double fChance = 1.0;
int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0);
// deprioritize very recent attempts away
if (nSinceLastTry < 60 * 10)
if (nNow - nLastTry < 60 * 10) {
fChance *= 0.01;
}
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
fChance *= pow(0.66, std::min(nAttempts, 8));