diff options
| author | Pieter Wuille <[email protected]> | 2016-09-09 12:48:10 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-09-19 15:53:47 +0200 |
| commit | d9ff591d42158e8a0a4ebdcf5fbb74978c483202 (patch) | |
| tree | 73b2ef1fae0b984e7612126c63846a7b39ccb2d7 /src/main.cpp | |
| parent | Merge #8754: [Doc] Target protobuf 2.6 in OS X build notes. (diff) | |
| download | discoin-d9ff591d42158e8a0a4ebdcf5fbb74978c483202.tar.xz discoin-d9ff591d42158e8a0a4ebdcf5fbb74978c483202.zip | |
Move static global randomizer seeds into CConnman
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 593897f51..1e191421b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -113,6 +113,8 @@ CScript COINBASE_FLAGS; const string strMessageMagic = "Bitcoin Signed Message:\n"; +static const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL; // SHA256("main address relay")[0:8] + // Internal stuff namespace { @@ -4739,11 +4741,9 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma // Relay to a limited number of other nodes // 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 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(); std::multimap<uint64_t, CNode*> mapMix; - const CSipHasher hasher = CSipHasher(salt0, salt1).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60)); + const CSipHasher hasher = connman.GetDeterministicRandomizer(RANDOMIZER_ID_ADDRESS_RELAY).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60)); auto sortfunc = [&mapMix, &hasher](CNode* pnode) { if (pnode->nVersion >= CADDR_TIME_VERSION) { |