@@ -1434,21 +1434,23 @@ bool static AlreadyHaveTx(const GenTxid& gtxid, const CTxMemPool& mempool) EXCLU
14341434 recentRejects->reset ();
14351435 }
14361436
1437+ const uint256& hash = gtxid.GetHash ();
1438+
14371439 {
14381440 LOCK (g_cs_orphans);
1439- if (!gtxid.IsWtxid () && mapOrphanTransactions.count (gtxid. GetHash () )) {
1441+ if (!gtxid.IsWtxid () && mapOrphanTransactions.count (hash )) {
14401442 return true ;
1441- } else if (gtxid.IsWtxid () && g_orphans_by_wtxid.count (gtxid. GetHash () )) {
1443+ } else if (gtxid.IsWtxid () && g_orphans_by_wtxid.count (hash )) {
14421444 return true ;
14431445 }
14441446 }
14451447
14461448 {
14471449 LOCK (g_cs_recent_confirmed_transactions);
1448- if (g_recent_confirmed_transactions->contains (gtxid. GetHash () )) return true ;
1450+ if (g_recent_confirmed_transactions->contains (hash )) return true ;
14491451 }
14501452
1451- return recentRejects->contains (gtxid. GetHash () ) || mempool.exists (gtxid);
1453+ return recentRejects->contains (hash ) || mempool.exists (gtxid);
14521454}
14531455
14541456bool static AlreadyHaveBlock (const uint256& block_hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
@@ -2645,8 +2647,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
26452647 const auto current_time = GetTime<std::chrono::microseconds>();
26462648 uint256* best_block{nullptr };
26472649
2648- for (CInv &inv : vInv)
2649- {
2650+ for (CInv& inv : vInv) {
26502651 if (interruptMsgProc) return ;
26512652
26522653 // Ignore INVs that don't match wtxidrelay setting.
@@ -2659,7 +2660,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
26592660 }
26602661
26612662 if (inv.IsMsgBlk ()) {
2662- bool fAlreadyHave = AlreadyHaveBlock (inv.hash );
2663+ const bool fAlreadyHave = AlreadyHaveBlock (inv.hash );
26632664 LogPrint (BCLog::NET, " got inv: %s %s peer=%d\n " , inv.ToString (), fAlreadyHave ? " have" : " new" , pfrom.GetId ());
26642665
26652666 UpdateBlockAvailability (pfrom.GetId (), inv.hash );
@@ -2672,8 +2673,8 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
26722673 best_block = &inv.hash ;
26732674 }
26742675 } else {
2675- GenTxid gtxid = ToGenTxid (inv);
2676- bool fAlreadyHave = AlreadyHaveTx (gtxid, mempool);
2676+ const GenTxid gtxid = ToGenTxid (inv);
2677+ const bool fAlreadyHave = AlreadyHaveTx (gtxid, mempool);
26772678 LogPrint (BCLog::NET, " got inv: %s %s peer=%d\n " , inv.ToString (), fAlreadyHave ? " have" : " new" , pfrom.GetId ());
26782679
26792680 pfrom.AddKnownTx (inv.hash );
@@ -3007,7 +3008,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
30073008 // wtxidrelay peers.
30083009 // Eventually we should replace this with an improved
30093010 // protocol for getting all unconfirmed parents.
3010- GenTxid gtxid{/* is_wtxid=*/ false , parent_txid};
3011+ const GenTxid gtxid{/* is_wtxid=*/ false , parent_txid};
30113012 pfrom.AddKnownTx (parent_txid);
30123013 if (!AlreadyHaveTx (gtxid, m_mempool)) RequestTx (State (pfrom.GetId ()), gtxid, current_time);
30133014 }
0 commit comments