mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
[addrman] Add deterministic argument to CAddrMan ctor
Removes the need for tests to update nKey and insecure_rand after constructing a CAddrMan.
This commit is contained in:
@@ -493,9 +493,11 @@ public:
|
||||
mapAddr.clear();
|
||||
}
|
||||
|
||||
CAddrMan()
|
||||
explicit CAddrMan(bool deterministic)
|
||||
: insecure_rand{deterministic}
|
||||
{
|
||||
Clear();
|
||||
if (deterministic) nKey.SetNull();
|
||||
}
|
||||
|
||||
~CAddrMan()
|
||||
@@ -637,13 +639,13 @@ protected:
|
||||
//! secret key to randomize bucket select with
|
||||
uint256 nKey;
|
||||
|
||||
//! Source of random numbers for randomization in inner loops
|
||||
mutable FastRandomContext insecure_rand GUARDED_BY(cs);
|
||||
|
||||
//! A mutex to protect the inner data structures.
|
||||
mutable Mutex cs;
|
||||
|
||||
private:
|
||||
//! Source of random numbers for randomization in inner loops
|
||||
mutable FastRandomContext insecure_rand GUARDED_BY(cs);
|
||||
|
||||
//! Serialization versions.
|
||||
enum Format : uint8_t {
|
||||
V0_HISTORICAL = 0, //!< historic format, before commit e6b343d88
|
||||
|
||||
Reference in New Issue
Block a user