Skip to content

Commit 71900b4

Browse files
committed
Merge pull request #6029
a784f90 Cap nAttempts penalty at 8 and switch to pow instead of a division loop. (Gregory Maxwell)
2 parents 2bc6332 + a784f90 commit 71900b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/addrman.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ double CAddrInfo::GetChance(int64_t nNow) const
6767
if (nSinceLastTry < 60 * 10)
6868
fChance *= 0.01;
6969

70-
// deprioritize 50% after each failed attempt
71-
for (int n = 0; n < nAttempts; n++)
72-
fChance /= 1.5;
70+
// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
71+
fChance *= pow(0.66, min(nAttempts, 8));
7372

7473
return fChance;
7574
}

0 commit comments

Comments
 (0)