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

Method GetChance

src/addrman.cpp:87–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87double AddrInfo::GetChance(int64_t nNow) const
88{
89 double fChance = 1.0;
90 int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0);
91
92 // deprioritize very recent attempts away
93 if (nSinceLastTry < 60 * 10)
94 fChance *= 0.01;
95
96 // deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
97 fChance *= pow(0.66, std::min(nAttempts, 8));
98
99 return fChance;
100}
101
102AddrManImpl::AddrManImpl(std::vector<bool>&& asmap, bool deterministic, int32_t consistency_check_ratio)
103 : insecure_rand{deterministic}

Callers 1

Select_Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected