mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Add missing GUARDED_BY to CAddrMan::insecure_rand
This commit is contained in:
parent
fab755b77f
commit
fa32024d51
4 changed files with 6 additions and 4 deletions
|
@ -631,12 +631,12 @@ protected:
|
||||||
uint256 nKey;
|
uint256 nKey;
|
||||||
|
|
||||||
//! Source of random numbers for randomization in inner loops
|
//! Source of random numbers for randomization in inner loops
|
||||||
mutable FastRandomContext insecure_rand;
|
mutable FastRandomContext insecure_rand GUARDED_BY(cs);
|
||||||
|
|
||||||
private:
|
|
||||||
//! A mutex to protect the inner data structures.
|
//! A mutex to protect the inner data structures.
|
||||||
mutable Mutex cs;
|
mutable Mutex cs;
|
||||||
|
|
||||||
|
private:
|
||||||
//! Serialization versions.
|
//! Serialization versions.
|
||||||
enum Format : uint8_t {
|
enum Format : uint8_t {
|
||||||
V0_HISTORICAL = 0, //!< historic format, before commit e6b343d88
|
V0_HISTORICAL = 0, //!< historic format, before commit e6b343d88
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
//! Ensure that bucket placement is always the same for testing purposes.
|
//! Ensure that bucket placement is always the same for testing purposes.
|
||||||
void MakeDeterministic()
|
void MakeDeterministic()
|
||||||
{
|
{
|
||||||
|
LOCK(cs);
|
||||||
nKey.SetNull();
|
nKey.SetNull();
|
||||||
insecure_rand = FastRandomContext(true);
|
insecure_rand = FastRandomContext(true);
|
||||||
}
|
}
|
||||||
|
@ -87,11 +88,11 @@ public:
|
||||||
{
|
{
|
||||||
CAddrMan::Clear();
|
CAddrMan::Clear();
|
||||||
if (deterministic) {
|
if (deterministic) {
|
||||||
|
LOCK(cs);
|
||||||
nKey.SetNull();
|
nKey.SetNull();
|
||||||
insecure_rand = FastRandomContext(true);
|
insecure_rand = FastRandomContext(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static CNetAddr ResolveIP(const std::string& ip)
|
static CNetAddr ResolveIP(const std::string& ip)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CAddrManDeterministic : public CAddrMan
|
||||||
public:
|
public:
|
||||||
void MakeDeterministic(const uint256& random_seed)
|
void MakeDeterministic(const uint256& random_seed)
|
||||||
{
|
{
|
||||||
insecure_rand = FastRandomContext{random_seed};
|
WITH_LOCK(cs, insecure_rand = FastRandomContext{random_seed});
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
//! Ensure that bucket placement is always the same for testing purposes.
|
//! Ensure that bucket placement is always the same for testing purposes.
|
||||||
void MakeDeterministic()
|
void MakeDeterministic()
|
||||||
{
|
{
|
||||||
|
LOCK(cs);
|
||||||
nKey.SetNull();
|
nKey.SetNull();
|
||||||
insecure_rand = FastRandomContext(true);
|
insecure_rand = FastRandomContext(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue