aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2021-05-12 16:53:25 +0200
committerJon Atack <jon@atack.com>2021-05-19 13:04:09 +0200
commitc38981e748f438d972ba12ba998c8a8a597e01c1 (patch)
treec34e8fa0dbdda0967531e2a551845c33f134a57b
parentd35ddca91ebbcf8d8b790c3b9f8cf218fafb7a53 (diff)
downloadbitcoin-c38981e748f438d972ba12ba998c8a8a597e01c1.tar.xz
p2p: pull time call out of loop in CAddrMan::GetAddr_()
-rw-r--r--src/addrman.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index ae2f1c23a2..ceab1689d7 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -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;
@@ -508,7 +509,7 @@ void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr, size_t max_addresses, size
if (network != std::nullopt && ai.GetNetClass() != network) continue;
// Filter for quality
- if (ai.IsTerrible()) continue;
+ if (ai.IsTerrible(now)) continue;
vAddr.push_back(ai);
}