aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-06-07 16:29:03 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-06-07 16:29:03 +0200
commit888483098e60f2a944f1d246bbfec4d14a2975f8 (patch)
tree3c1ebad509c274f0bdedbc9193aef45aefb1e104 /src/net.cpp
parentc31b24f745a84669f2af729052da7fd7ed2da868 (diff)
downloadbitcoin-888483098e60f2a944f1d246bbfec4d14a2975f8.tar.xz
Use C++11 thread-safe static initializers
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 0bc501601d..e29053cf54 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2601,12 +2601,8 @@ int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds) {
/* static */ uint64_t CNode::CalculateKeyedNetGroup(const CAddress& ad)
{
- static uint64_t k0 = 0, k1 = 0;
- while (k0 == 0 && k1 == 0) {
- // Make sure this only runs on the first invocation.
- GetRandBytes((unsigned char*)&k0, sizeof(k0));
- GetRandBytes((unsigned char*)&k1, sizeof(k1));
- }
+ static const uint64_t k0 = GetRand(std::numeric_limits<uint64_t>::max());
+ static const uint64_t k1 = GetRand(std::numeric_limits<uint64_t>::max());
std::vector<unsigned char> vchNetGroup(ad.GetGroup());