aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-04-20 13:55:38 +0200
committerWladimir J. van der Laan <[email protected]>2015-04-20 13:59:50 +0200
commit71900b4426adc96322c432a42b952c685f8b3b7f (patch)
tree13a8bec6b54dabae060f378877f74e3444cebafb /src/addrman.cpp
parentMerge pull request #6010 (diff)
parentCap nAttempts penalty at 8 and switch to pow instead of a division loop. (diff)
downloaddiscoin-71900b4426adc96322c432a42b952c685f8b3b7f.tar.xz
discoin-71900b4426adc96322c432a42b952c685f8b3b7f.zip
Merge pull request #6029
a784f90 Cap nAttempts penalty at 8 and switch to pow instead of a division loop. (Gregory Maxwell)
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r--src/addrman.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 5d9527f0e..094c913e9 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -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;
}