marcofleon committed 2025-07-23 15:01:18 +01:00
1 parent 184159e4f3
commit d588575ed1
4 files changed
+7 -6

No files matched your search

+2 -2
View File
@@ -962,9 +962,9 @@ const CTransaction* CTxMemPool::GetConflictTx(const COutPoint& prevout) const
std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const Txid& txid) const std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const Txid& txid) const
{ {
AssertLockHeld(cs);
auto it = mapTx.find(txid.ToUint256()); auto it = mapTx.find(txid.ToUint256());
if (it != mapTx.end()) return it; return it != mapTx.end() ? std::make_optional(it) : std::nullopt;
return std::nullopt;
} }
std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const Wtxid& wtxid) const std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const Wtxid& wtxid) const
+2 -2
View File
@@ -595,7 +595,7 @@ public:
//! Find the GenTxids to request now from peer. //! Find the GenTxids to request now from peer.
std::vector<GenTxid> GetRequestable(NodeId peer, std::chrono::microseconds now, std::vector<GenTxid> GetRequestable(NodeId peer, std::chrono::microseconds now,
std::vector<std::pair<NodeId, GenTxid>>* expired) std::vector<std::pair<NodeId, GenTxid>>* expired)
{ {
// Move time. // Move time.
SetTimePoint(now, expired); SetTimePoint(now, expired);
@@ -746,7 +746,7 @@ void TxRequestTracker::ReceivedResponse(NodeId peer, const uint256& txhash)
} }
std::vector<GenTxid> TxRequestTracker::GetRequestable(NodeId peer, std::chrono::microseconds now, std::vector<GenTxid> TxRequestTracker::GetRequestable(NodeId peer, std::chrono::microseconds now,
std::vector<std::pair<NodeId, GenTxid>>* expired) std::vector<std::pair<NodeId, GenTxid>>* expired)
{ {
return m_impl->GetRequestable(peer, now, expired); return m_impl->GetRequestable(peer, now, expired);
} }
+1 -1
View File
@@ -164,7 +164,7 @@ public:
* simultaneously by one peer, and end up being requested from them, the requests will happen in announcement order. * simultaneously by one peer, and end up being requested from them, the requests will happen in announcement order.
*/ */
std::vector<GenTxid> GetRequestable(NodeId peer, std::chrono::microseconds now, std::vector<GenTxid> GetRequestable(NodeId peer, std::chrono::microseconds now,
std::vector<std::pair<NodeId, GenTxid>>* expired = nullptr); std::vector<std::pair<NodeId, GenTxid>>* expired = nullptr);
/** Marks a transaction as requested, with a specified expiry. /** Marks a transaction as requested, with a specified expiry.
* *
+2 -1
View File
@@ -98,7 +98,8 @@ public:
friend auto operator<=>(const GenTxid& a, const GenTxid& b) friend auto operator<=>(const GenTxid& a, const GenTxid& b)
{ {
return std::tuple(a.IsWtxid(), a.ToUint256()) <=> std::tuple(b.IsWtxid(), b.ToUint256()); // Use a reference for read-only access to the hash, avoiding a copy that might not be optimized away.
return std::tuple<bool, const uint256&>(a.IsWtxid(), a.ToUint256()) <=> std::tuple<bool, const uint256&>(b.IsWtxid(), b.ToUint256());
} }
}; };