mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #6424: refactor: move expensive CInv initialization out of hot loop
b65f0bab7f
refactor: move expensive CInv initialization out of hot loop (pasta) Pull request description: ## Issue being fixed or feature implemented Not sure how we introduced this one, but it appears we are calling a CInv construction (pretty cheap) and a GetDSTX ((relatively) EXPENSIVE) for each peer we are connected to in RelayTransaction... I can hope and pray that the compiler somehow was magically optimizing this for us, but I really doubt it ## What was done? Move the initialization out of the loop ## How Has This Been Tested? ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: knst: utACKb65f0bab7f
UdjinM6: utACKb65f0bab7f
kwvg: utACKb65f0bab7f
Tree-SHA512: f556789042ab9265d5c4d87c3ba2910138ce43ffa69c90ed208c9a3bcd861343f201ce2f00aeb541f345c9ca686dac7227df8d4833cf7fbdf61c36260f627864
This commit is contained in:
commit
0398b1cd72
@ -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);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user