From b65f0bab7f55f8cc27e72828d0f9045c1e6181d7 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 21 Nov 2024 13:54:37 -0600 Subject: [PATCH] refactor: move expensive CInv initialization out of hot loop --- src/net_processing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index b6f75dfa00155..19bd7de3f58b2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2328,13 +2328,13 @@ void PeerManagerImpl::RelayInvFiltered(CInv &inv, const uint256& relatedTxHash, void PeerManagerImpl::RelayTransaction(const uint256& txid) { + const CInv inv{m_cj_ctx->dstxman->GetDSTX(txid) ? MSG_DSTX : MSG_TX, txid}; LOCK(m_peer_mutex); for(auto& it : m_peer_map) { Peer& peer = *it.second; auto tx_relay = peer.GetTxRelay(); if (!tx_relay) continue; - const CInv inv{m_cj_ctx->dstxman->GetDSTX(txid) ? MSG_DSTX : MSG_TX, txid}; PushInv(peer, inv); }; }