Move rand functions from util to new random.h/.cpp
[novacoin.git] / src / net.cpp
index 75280b3..cd89567 100644 (file)
@@ -9,6 +9,7 @@
 #include "init.h"
 #include "addrman.h"
 #include "interface.h"
+#include "main.h"
 #include "miner.h"
 #include "ntp.h"
 
@@ -17,7 +18,6 @@
 #endif
 
 using namespace std;
-using namespace boost;
 
 static const int MAX_OUTBOUND_CONNECTIONS = 16;
 
@@ -57,7 +57,7 @@ static CNode* pnodeLocalHost = NULL;
 static CNode* pnodeSync = NULL;
 CAddress addrSeenByPeer(CService("0.0.0.0", nPortZero), nLocalServices);
 uint64_t nLocalHostNonce = 0;
-boost::array<int, THREAD_MAX> vnThreadsRunning;
+std::array<int, THREAD_MAX> vnThreadsRunning;
 static std::vector<SOCKET> vhListenSocket;
 CAddrMan addrman;
 
@@ -528,7 +528,7 @@ void CNode::PushVersion()
         addrMe = GetLocalAddress(&addr);
     }
 
-    RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
+    GetRandBytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
     printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
     PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
                 nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);