MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsTerrible

Method IsTerrible

src/addrman.cpp:67–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67bool AddrInfo::IsTerrible(int64_t nNow) const
68{
69 if (nLastTry && nLastTry >= nNow - 60) // never remove things tried in the last minute
70 return false;
71
72 if (nTime > nNow + 10 * 60) // came in a flying DeLorean
73 return true;
74
75 if (nTime == 0 || nNow - nTime > ADDRMAN_HORIZON_DAYS * 24 * 60 * 60) // not seen in recent history
76 return true;
77
78 if (nLastSuccess == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
79 return true;
80
81 if (nNow - nLastSuccess > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
82 return true;
83
84 return false;
85}
86
87double AddrInfo::GetChance(int64_t nNow) const
88{

Callers 2

AddSingleMethod · 0.80
GetAddr_Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected