mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Use arith_uint256 where necessary
Also add conversion from/to uint256 where needed.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "arith_uint256.h"
|
||||
#include "addrman.h"
|
||||
#include "alert.h"
|
||||
#include "chainparams.h"
|
||||
@@ -3607,7 +3608,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
if (hashSalt.IsNull())
|
||||
hashSalt = GetRandHash();
|
||||
uint64_t hashAddr = addr.GetHash();
|
||||
uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60));
|
||||
uint256 hashRand = ArithToUint256(UintToArith256(hashSalt) ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)));
|
||||
hashRand = Hash(BEGIN(hashRand), END(hashRand));
|
||||
multimap<uint256, CNode*> mapMix;
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
@@ -3616,7 +3617,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
continue;
|
||||
unsigned int nPointer;
|
||||
memcpy(&nPointer, &pnode, sizeof(nPointer));
|
||||
uint256 hashKey = hashRand ^ nPointer;
|
||||
uint256 hashKey = ArithToUint256(UintToArith256(hashRand) ^ nPointer);
|
||||
hashKey = Hash(BEGIN(hashKey), END(hashKey));
|
||||
mapMix.insert(make_pair(hashKey, pnode));
|
||||
}
|
||||
@@ -4485,9 +4486,9 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
|
||||
static uint256 hashSalt;
|
||||
if (hashSalt.IsNull())
|
||||
hashSalt = GetRandHash();
|
||||
uint256 hashRand = inv.hash ^ hashSalt;
|
||||
uint256 hashRand = ArithToUint256(UintToArith256(inv.hash) ^ UintToArith256(hashSalt));
|
||||
hashRand = Hash(BEGIN(hashRand), END(hashRand));
|
||||
bool fTrickleWait = ((hashRand & 3) != 0);
|
||||
bool fTrickleWait = ((UintToArith256(hashRand) & 3) != 0);
|
||||
|
||||
if (fTrickleWait)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user