mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Move static global randomizer seeds into CConnman
This commit is contained in:
13
src/net.h
13
src/net.h
@@ -11,6 +11,7 @@
|
||||
#include "amount.h"
|
||||
#include "bloom.h"
|
||||
#include "compat.h"
|
||||
#include "hash.h"
|
||||
#include "limitedmap.h"
|
||||
#include "netaddress.h"
|
||||
#include "protocol.h"
|
||||
@@ -121,7 +122,7 @@ public:
|
||||
unsigned int nSendBufferMaxSize = 0;
|
||||
unsigned int nReceiveFloodSize = 0;
|
||||
};
|
||||
CConnman();
|
||||
CConnman(uint64_t seed0, uint64_t seed1);
|
||||
~CConnman();
|
||||
bool Start(boost::thread_group& threadGroup, CScheduler& scheduler, std::string& strNodeError, Options options);
|
||||
void Stop();
|
||||
@@ -294,6 +295,8 @@ public:
|
||||
void SetBestHeight(int height);
|
||||
int GetBestHeight() const;
|
||||
|
||||
/** Get a unique deterministic randomizer. */
|
||||
CSipHasher GetDeterministicRandomizer(uint64_t id);
|
||||
|
||||
private:
|
||||
struct ListenSocket {
|
||||
@@ -311,6 +314,8 @@ private:
|
||||
void ThreadSocketHandler();
|
||||
void ThreadDNSAddressSeed();
|
||||
|
||||
uint64_t CalculateKeyedNetGroup(const CAddress& ad);
|
||||
|
||||
CNode* FindNode(const CNetAddr& ip);
|
||||
CNode* FindNode(const CSubNet& subNet);
|
||||
CNode* FindNode(const std::string& addrName);
|
||||
@@ -388,6 +393,9 @@ private:
|
||||
int nMaxFeeler;
|
||||
std::atomic<int> nBestHeight;
|
||||
CClientUIInterface* clientInterface;
|
||||
|
||||
/** SipHasher seeds for deterministic randomness */
|
||||
const uint64_t nSeed0, nSeed1;
|
||||
};
|
||||
extern std::unique_ptr<CConnman> g_connman;
|
||||
void Discover(boost::thread_group& threadGroup);
|
||||
@@ -656,14 +664,13 @@ public:
|
||||
CAmount lastSentFeeFilter;
|
||||
int64_t nextSendTimeFeeFilter;
|
||||
|
||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, const std::string &addrNameIn = "", bool fInboundIn = false);
|
||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, const std::string &addrNameIn = "", bool fInboundIn = false);
|
||||
~CNode();
|
||||
|
||||
private:
|
||||
CNode(const CNode&);
|
||||
void operator=(const CNode&);
|
||||
|
||||
static uint64_t CalculateKeyedNetGroup(const CAddress& ad);
|
||||
|
||||
uint64_t nLocalHostNonce;
|
||||
ServiceFlags nLocalServices;
|
||||
|
||||
Reference in New Issue
Block a user