53 size_t rnd = rand() % tot;
55 if (rnd <
unkId.size()) {
56 std::set<int>::iterator it =
unkId.end();
90 int blocks, uint64_t services) {
136 if (
goodId.count(
id) == 1) {
152 time_t bantime =
banned[ipp];
153 if (force || (bantime < time(
nullptr) && addr.
nTime > bantime)) {
190 uint32_t max,
const bool *nets) {
193 if (
ourId.size() == 0) {
194 if (
unkId.size() == 0) {
203 (
idToInfo[
id].services & requestedFlags) == requestedFlags) {
209 std::vector<int> goodIdFiltered;
211 if ((
idToInfo[
id].services & requestedFlags) == requestedFlags) {
212 goodIdFiltered.push_back(
id);
216 if (!goodIdFiltered.size()) {
220 if (max > goodIdFiltered.size() / 2) {
221 max = goodIdFiltered.size() / 2;
229 while (ids.size() < max) {
230 ids.insert(goodIdFiltered[rand() % goodIdFiltered.size()]);
233 for (
auto &
id : ids) {
void Bad_(const CService &ip, int ban)
void Good_(const CService &ip, int clientV, std::string clientSV, int blocks, uint64_t services)
void GetIPs_(std::set< CNetAddr > &ips, uint64_t requestedFlags, uint32_t max, const bool *nets)
std::map< CService, int > ipToId
std::map< CService, int64_t > banned
std::map< int, SeederAddrInfo > idToInfo
void Add_(const CAddress &addr, bool force)
bool Get_(CServiceResult &ip, int &wait)
int Lookup_(const CService &ip)
void Update(bool good, int64_t age, double tau)
A CService with information about it as peer.
enum Network GetNetwork() const
A combination of a network address (CNetAddr) and a (TCP) port.
int64_t GetIgnoreTime() const
int64_t GetBanTime() const
std::string clientSubVersion
T GetTime()
Return system time (or mocked time, if set)