Merge pull request #6029
a784f90
Cap nAttempts penalty at 8 and switch to pow instead of a division loop. (Gregory Maxwell)
This commit is contained in:
commit
71900b4426
@ -67,9 +67,8 @@ double CAddrInfo::GetChance(int64_t nNow) const
|
|||||||
if (nSinceLastTry < 60 * 10)
|
if (nSinceLastTry < 60 * 10)
|
||||||
fChance *= 0.01;
|
fChance *= 0.01;
|
||||||
|
|
||||||
// deprioritize 50% after each failed attempt
|
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
|
||||||
for (int n = 0; n < nAttempts; n++)
|
fChance *= pow(0.66, min(nAttempts, 8));
|
||||||
fChance /= 1.5;
|
|
||||||
|
|
||||||
return fChance;
|
return fChance;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user