Skip to content

Commit

Permalink
p2p: pull time call out of loop in CAddrMan::GetAddr_()
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzbawls committed Aug 12, 2021
1 parent d5c1250 commit a4d2733
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr, size_t max_addresses, size
}

// gather a list of random nodes, skipping those of low quality
const int64_t now{GetAdjustedTime()};
for (unsigned int n = 0; n < vRandom.size(); n++) {
if (vAddr.size() >= nNodes)
break;
Expand All @@ -508,7 +509,7 @@ void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr, size_t max_addresses, size
if (network != nullopt && ai.GetNetClass() != network) continue;

// Filter for quality
if (ai.IsTerrible()) continue;
if (ai.IsTerrible(now)) continue;

vAddr.push_back(ai);
}
Expand Down

0 comments on commit a4d2733

Please sign in to comment.