diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2017-02-03 09:20:54 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2017-02-07 15:46:38 +0100 |
commit | a47da4b6fecaba81dafe777b25be24e04a428e37 (patch) | |
tree | 2ef78a9d89b312b71aa06316443ce2de96d58c8e /src/addrman.cpp | |
parent | b709fe7ffc44ae14bbd2403cdfbfa4fcf94cef6b (diff) |
Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0;
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r-- | src/addrman.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index f3c238fbb2..b6ab4c6305 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -53,11 +53,7 @@ bool CAddrInfo::IsTerrible(int64_t nNow) const double CAddrInfo::GetChance(int64_t nNow) const { double fChance = 1.0; - - int64_t nSinceLastTry = nNow - nLastTry; - - if (nSinceLastTry < 0) - nSinceLastTry = 0; + int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0); // deprioritize very recent attempts away if (nSinceLastTry < 60 * 10) |