8d4b14e001ec026f346c6b4b00509adae7769415
I’d use a different approach to not mix different conditions:
0// Filter by network (optional)
1if (network != std::nullopt && ai.GetNetClass() != network) continue;
2
3// Filter for quality
4if (ai.IsTerrible()) continue;
5
6vAddr.push_back(ai);
Also note that it first filters by network, which I think is slightly better.
I also want to point that IsTerrible
default argument is computed in each iteration, I’d suggest:
0 const int64_t now = GetAdjustedTime();
1
2 // gather a list of random nodes, skipping those of low quality
3 for (unsigned int n = 0; n < vRandom.size(); n++) {
4 ...
5 if (ai.IsTerrible(now)) continue;