diff options
| author | Pieter Wuille <[email protected]> | 2016-06-07 16:29:03 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-06-07 16:29:03 +0200 |
| commit | 888483098e60f2a944f1d246bbfec4d14a2975f8 (patch) | |
| tree | 3c1ebad509c274f0bdedbc9193aef45aefb1e104 /src/main.cpp | |
| parent | Use 64-bit SipHash of netgroups in eviction (diff) | |
| download | discoin-888483098e60f2a944f1d246bbfec4d14a2975f8.tar.xz discoin-888483098e60f2a944f1d246bbfec4d14a2975f8.zip | |
Use C++11 thread-safe static initializers
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index bf6e6d04b..da140cffa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4784,11 +4784,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LOCK(cs_vNodes); // Use deterministic randomness to send to the same nodes for 24 hours // at a time so the addrKnowns of the chosen nodes prevent repeats - static uint64_t salt0 = 0, salt1 = 0; - while (salt0 == 0 && salt1 == 0) { - GetRandBytes((unsigned char*)&salt0, sizeof(salt0)); - GetRandBytes((unsigned char*)&salt1, sizeof(salt1)); - } + static const uint64_t salt0 = GetRand(std::numeric_limits<uint64_t>::max()); + static const uint64_t salt1 = GetRand(std::numeric_limits<uint64_t>::max()); uint64_t hashAddr = addr.GetHash(); multimap<uint64_t, CNode*> mapMix; const CSipHasher hasher = CSipHasher(salt0, salt1).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60)); |