@@ -261,7 +261,7 @@ struct CNodeState {
261261 nMisbehavior = 0 ;
262262 fShouldBan = false ;
263263 pindexBestKnownBlock = NULL ;
264- hashLastUnknownBlock = uint256 ( 0 );
264+ hashLastUnknownBlock. SetNull ( );
265265 pindexLastCommonBlock = NULL ;
266266 fSyncStarted = false ;
267267 nStallingSince = 0 ;
@@ -349,12 +349,12 @@ void ProcessBlockAvailability(NodeId nodeid) {
349349 CNodeState *state = State (nodeid);
350350 assert (state != NULL );
351351
352- if (state->hashLastUnknownBlock != 0 ) {
352+ if (! state->hashLastUnknownBlock . IsNull () ) {
353353 BlockMap::iterator itOld = mapBlockIndex.find (state->hashLastUnknownBlock );
354354 if (itOld != mapBlockIndex.end () && itOld->second ->nChainWork > 0 ) {
355355 if (state->pindexBestKnownBlock == NULL || itOld->second ->nChainWork >= state->pindexBestKnownBlock ->nChainWork )
356356 state->pindexBestKnownBlock = itOld->second ;
357- state->hashLastUnknownBlock = uint256 ( 0 );
357+ state->hashLastUnknownBlock . SetNull ( );
358358 }
359359 }
360360}
@@ -1712,7 +1712,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
17121712 return false ;
17131713
17141714 // verify that the view's current state corresponds to the previous block
1715- uint256 hashPrevBlock = pindex->pprev == NULL ? uint256 (0 ) : pindex->pprev ->GetBlockHash ();
1715+ uint256 hashPrevBlock = pindex->pprev == NULL ? uint256 () : pindex->pprev ->GetBlockHash ();
17161716 assert (hashPrevBlock == view.GetBestBlock ());
17171717
17181718 // Special case for the genesis block, skipping connection of its transactions
@@ -2835,7 +2835,7 @@ boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char
28352835
28362836CBlockIndex * InsertBlockIndex (uint256 hash)
28372837{
2838- if (hash == 0 )
2838+ if (hash. IsNull () )
28392839 return NULL ;
28402840
28412841 // Return existing
@@ -3369,7 +3369,7 @@ void static ProcessGetData(CNode* pfrom)
33693369 vector<CInv> vInv;
33703370 vInv.push_back (CInv (MSG_BLOCK, chainActive.Tip ()->GetBlockHash ()));
33713371 pfrom->PushMessage (" inv" , vInv);
3372- pfrom->hashContinue = 0 ;
3372+ pfrom->hashContinue . SetNull () ;
33733373 }
33743374 }
33753375 }
@@ -3604,7 +3604,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
36043604 // Use deterministic randomness to send to the same nodes for 24 hours
36053605 // at a time so the setAddrKnowns of the chosen nodes prevent repeats
36063606 static uint256 hashSalt;
3607- if (hashSalt == 0 )
3607+ if (hashSalt. IsNull () )
36083608 hashSalt = GetRandHash ();
36093609 uint64_t hashAddr = addr.GetHash ();
36103610 uint256 hashRand = hashSalt ^ (hashAddr<<32 ) ^ ((GetTime ()+hashAddr)/(24 *60 *60 ));
@@ -3738,7 +3738,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
37383738 if (pindex)
37393739 pindex = chainActive.Next (pindex);
37403740 int nLimit = 500 ;
3741- LogPrint (" net" , " getblocks %d to %s limit %d from peer=%d\n " , (pindex ? pindex->nHeight : -1 ), hashStop== uint256 ( 0 ) ? " end" : hashStop.ToString (), nLimit, pfrom->id );
3741+ LogPrint (" net" , " getblocks %d to %s limit %d from peer=%d\n " , (pindex ? pindex->nHeight : -1 ), hashStop. IsNull ( ) ? " end" : hashStop.ToString (), nLimit, pfrom->id );
37423742 for (; pindex; pindex = chainActive.Next (pindex))
37433743 {
37443744 if (pindex->GetBlockHash () == hashStop)
@@ -3954,7 +3954,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
39543954 // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
39553955 // from there instead.
39563956 LogPrint (" net" , " more getheaders (%d) to end to peer=%d (startheight:%d)\n " , pindexLast->nHeight , pfrom->id , pfrom->nStartingHeight );
3957- pfrom->PushMessage (" getheaders" , chainActive.GetLocator (pindexLast), uint256 (0 ));
3957+ pfrom->PushMessage (" getheaders" , chainActive.GetLocator (pindexLast), uint256 ());
39583958 }
39593959 }
39603960
@@ -4452,7 +4452,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
44524452 nSyncStarted++;
44534453 CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
44544454 LogPrint (" net" , " initial getheaders (%d) to peer=%d (startheight:%d)\n " , pindexStart->nHeight , pto->id , pto->nStartingHeight );
4455- pto->PushMessage (" getheaders" , chainActive.GetLocator (pindexStart), uint256 (0 ));
4455+ pto->PushMessage (" getheaders" , chainActive.GetLocator (pindexStart), uint256 ());
44564456 }
44574457 }
44584458
@@ -4483,7 +4483,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
44834483 {
44844484 // 1/4 of tx invs blast to all immediately
44854485 static uint256 hashSalt;
4486- if (hashSalt == 0 )
4486+ if (hashSalt. IsNull () )
44874487 hashSalt = GetRandHash ();
44884488 uint256 hashRand = inv.hash ^ hashSalt;
44894489 hashRand = Hash (BEGIN (hashRand), END (hashRand));
0 commit comments