aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-07-22 20:56:27 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-07-23 11:31:05 +0200
commitfa32024d51c098441623e246f304a80f011e29d1 (patch)
treee2c6bc1c7dcc2454241093b8bc7590716d228227 /src/test
parentfab755b77f88873f01cbd988051de7ad3f0150de (diff)
Add missing GUARDED_BY to CAddrMan::insecure_rand
Diffstat (limited to 'src/test')
-rw-r--r--src/test/addrman_tests.cpp3
-rw-r--r--src/test/fuzz/addrman.cpp2
-rw-r--r--src/test/net_tests.cpp1
3 files changed, 4 insertions, 2 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp
index 5e5c5eba69..79c7102c4f 100644
--- a/src/test/addrman_tests.cpp
+++ b/src/test/addrman_tests.cpp
@@ -34,6 +34,7 @@ public:
//! Ensure that bucket placement is always the same for testing purposes.
void MakeDeterministic()
{
+ LOCK(cs);
nKey.SetNull();
insecure_rand = FastRandomContext(true);
}
@@ -87,11 +88,11 @@ public:
{
CAddrMan::Clear();
if (deterministic) {
+ LOCK(cs);
nKey.SetNull();
insecure_rand = FastRandomContext(true);
}
}
-
};
static CNetAddr ResolveIP(const std::string& ip)
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
index ee9485eba5..fb003ea3a8 100644
--- a/src/test/fuzz/addrman.cpp
+++ b/src/test/fuzz/addrman.cpp
@@ -27,7 +27,7 @@ class CAddrManDeterministic : public CAddrMan
public:
void MakeDeterministic(const uint256& random_seed)
{
- insecure_rand = FastRandomContext{random_seed};
+ WITH_LOCK(cs, insecure_rand = FastRandomContext{random_seed});
Clear();
}
};
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index 46f88c1282..acbbf357d2 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -37,6 +37,7 @@ public:
//! Ensure that bucket placement is always the same for testing purposes.
void MakeDeterministic()
{
+ LOCK(cs);
nKey.SetNull();
insecure_rand = FastRandomContext(true);
}