Skip to content

Commit

Permalink
Merge pull request #6029
Browse files Browse the repository at this point in the history
a784f90 Cap nAttempts penalty at 8 and switch to pow instead of a division loop. (Gregory Maxwell)
  • Loading branch information
laanwj committed Apr 20, 2015
2 parents 2bc6332 + a784f90 commit 71900b4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ double CAddrInfo::GetChance(int64_t nNow) const
if (nSinceLastTry < 60 * 10)
fChance *= 0.01;

// deprioritize 50% after each failed attempt
for (int n = 0; n < nAttempts; n++)
fChance /= 1.5;
// 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, min(nAttempts, 8));

return fChance;
}
Expand Down

0 comments on commit 71900b4

Please sign in to comment.