mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Merge bitcoin/bitcoin#27610: Improve performance of p2p inv to send queues
5b3406094fnet_processing: Boost inv trickle rate (Anthony Towns)228e9201eftxmempool: have CompareDepthAndScore sort missing txs first (Anthony Towns) Pull request description: Couple of performance improvements when draining the inventory-to-send queue: * drop txs that have already been evicted from the mempool (or included in a block) immediately, rather than at the end of processing * marginally increase outgoing trickle rate during spikes in tx volume ACKs for top commit: willcl-ark: ACK5b34060instagibbs: ACK5b3406094fdarosior: utACK5b3406094fglozow: code review ACK5b3406094fdergoegge: utACK5b3406094fTree-SHA512: 155cd3b5d150ba3417c1cd126f2be734497742e85358a19c9d365f4f97c555ff9e846405bbeada13c3575b3713c3a7eb2f780879a828cbbf032ad9a6e5416b30
This commit is contained in:
@@ -5677,7 +5677,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
// especially since we have many peers and some will draw much shorter delays.
|
||||
unsigned int nRelayedTransactions = 0;
|
||||
LOCK(tx_relay->m_bloom_filter_mutex);
|
||||
while (!vInvTx.empty() && nRelayedTransactions < INVENTORY_BROADCAST_MAX) {
|
||||
size_t broadcast_max{INVENTORY_BROADCAST_MAX + (tx_relay->m_tx_inventory_to_send.size()/1000)*5};
|
||||
broadcast_max = std::min<size_t>(1000, broadcast_max);
|
||||
while (!vInvTx.empty() && nRelayedTransactions < broadcast_max) {
|
||||
// Fetch the top element from the heap
|
||||
std::pop_heap(vInvTx.begin(), vInvTx.end(), compareInvMempoolOrder);
|
||||
std::set<uint256>::iterator it = vInvTx.back();
|
||||
|
||||
Reference in New Issue
Block a user