|
|
@ -201,9 +201,7 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) |
|
|
|
while (mapOrphanTransactions.size() > nMaxOrphans) |
|
|
|
while (mapOrphanTransactions.size() > nMaxOrphans) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Evict a random orphan:
|
|
|
|
// Evict a random orphan:
|
|
|
|
std::vector<unsigned char> randbytes(32); |
|
|
|
uint256 randomhash = GetRandHash(); |
|
|
|
RAND_bytes(&randbytes[0], 32); |
|
|
|
|
|
|
|
uint256 randomhash(randbytes); |
|
|
|
|
|
|
|
map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash); |
|
|
|
map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash); |
|
|
|
if (it == mapOrphanTransactions.end()) |
|
|
|
if (it == mapOrphanTransactions.end()) |
|
|
|
it = mapOrphanTransactions.begin(); |
|
|
|
it = mapOrphanTransactions.begin(); |
|
|
@ -2354,7 +2352,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
// at a time so the setAddrKnowns of the chosen nodes prevent repeats
|
|
|
|
// at a time so the setAddrKnowns of the chosen nodes prevent repeats
|
|
|
|
static uint256 hashSalt; |
|
|
|
static uint256 hashSalt; |
|
|
|
if (hashSalt == 0) |
|
|
|
if (hashSalt == 0) |
|
|
|
RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt)); |
|
|
|
hashSalt = GetRandHash(); |
|
|
|
int64 hashAddr = addr.GetHash(); |
|
|
|
int64 hashAddr = addr.GetHash(); |
|
|
|
uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); |
|
|
|
uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); |
|
|
|
hashRand = Hash(BEGIN(hashRand), END(hashRand)); |
|
|
|
hashRand = Hash(BEGIN(hashRand), END(hashRand)); |
|
|
@ -2945,7 +2943,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) |
|
|
|
// 1/4 of tx invs blast to all immediately
|
|
|
|
// 1/4 of tx invs blast to all immediately
|
|
|
|
static uint256 hashSalt; |
|
|
|
static uint256 hashSalt; |
|
|
|
if (hashSalt == 0) |
|
|
|
if (hashSalt == 0) |
|
|
|
RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt)); |
|
|
|
hashSalt = GetRandHash(); |
|
|
|
uint256 hashRand = inv.hash ^ hashSalt; |
|
|
|
uint256 hashRand = inv.hash ^ hashSalt; |
|
|
|
hashRand = Hash(BEGIN(hashRand), END(hashRand)); |
|
|
|
hashRand = Hash(BEGIN(hashRand), END(hashRand)); |
|
|
|
bool fTrickleWait = ((hashRand & 3) != 0); |
|
|
|
bool fTrickleWait = ((hashRand & 3) != 0); |
|
|
|