diff options
-rw-r--r-- | src/addrman.cpp | 12 | ||||
-rw-r--r-- | src/kernel/context.h | 2 | ||||
-rw-r--r-- | test/lint/spelling.ignore-words.txt | 1 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index ed823eeb05..204bb544c5 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -66,14 +66,16 @@ int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) con bool AddrInfo::IsTerrible(int64_t nNow) const { - if (nLastTry && nLastTry >= nNow - 60) // never remove things tried in the last minute + if (nNow - nLastTry <= 60) { // never remove things tried in the last minute return false; + } if (nTime > nNow + 10 * 60) // came in a flying DeLorean return true; - if (nTime == 0 || nNow - nTime > ADDRMAN_HORIZON_DAYS * 24 * 60 * 60) // not seen in recent history + if (nNow - nTime > ADDRMAN_HORIZON_DAYS * 24 * 60 * 60) { // not seen in recent history return true; + } if (nLastSuccess == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success return true; @@ -557,15 +559,17 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_ // periodically update nTime bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60); int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60); - if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty)) + if (pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty) { pinfo->nTime = std::max((int64_t)0, addr.nTime - nTimePenalty); + } // add services pinfo->nServices = ServiceFlags(pinfo->nServices | addr.nServices); // do not update if no new information is present - if (!addr.nTime || (pinfo->nTime && addr.nTime <= pinfo->nTime)) + if (addr.nTime <= pinfo->nTime) { return false; + } // do not update if the entry was already in the "tried" table if (pinfo->fInTried) diff --git a/src/kernel/context.h b/src/kernel/context.h index 0a08511564..9746ef994b 100644 --- a/src/kernel/context.h +++ b/src/kernel/context.h @@ -12,7 +12,7 @@ class ECCVerifyHandle; namespace kernel { //! Context struct holding the kernel library's logically global state, and //! passed to external libbitcoin_kernel functions which need access to this -//! state. The kernel libary API is a work in progress, so state organization +//! state. The kernel library API is a work in progress, so state organization //! and member list will evolve over time. //! //! State stored directly in this struct should be simple. More complex state diff --git a/test/lint/spelling.ignore-words.txt b/test/lint/spelling.ignore-words.txt index c931a0aae1..0efd298408 100644 --- a/test/lint/spelling.ignore-words.txt +++ b/test/lint/spelling.ignore-words.txt @@ -3,6 +3,7 @@ ba blockin cachable creat +desig fo fpr hights |