aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-09-19 17:05:35 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-09-19 18:02:01 +0200
commit047ded0b12f3d8da3fb4220963ae3f68579b1176 (patch)
tree63d442dd1f5e508aaffc5330c3f27f9ec1c0ca83 /src/net.h
parent894c0ad9a9abce703e4a5d7456f2d0477deb5bc0 (diff)
parentd9ff591d42158e8a0a4ebdcf5fbb74978c483202 (diff)
downloadbitcoin-047ded0b12f3d8da3fb4220963ae3f68579b1176.tar.xz
Merge #8688: Move static global randomizer seeds into CConnman
d9ff591 Move static global randomizer seeds into CConnman (Pieter Wuille)
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/net.h b/src/net.h
index dbed8b3dd5..0173854669 100644
--- a/src/net.h
+++ b/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"
@@ -125,7 +126,7 @@ public:
uint64_t nMaxOutboundTimeframe = 0;
uint64_t nMaxOutboundLimit = 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();
@@ -298,6 +299,8 @@ public:
void SetBestHeight(int height);
int GetBestHeight() const;
+ /** Get a unique deterministic randomizer. */
+ CSipHasher GetDeterministicRandomizer(uint64_t id);
private:
struct ListenSocket {
@@ -315,6 +318,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);
@@ -392,6 +397,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);
@@ -660,14 +668,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;