Index: src/net_processing.cpp =================================================================== --- src/net_processing.cpp +++ src/net_processing.cpp @@ -22,6 +22,7 @@ #include "primitives/block.h" #include "primitives/transaction.h" #include "random.h" +#include "serialize.h" #include "tinyformat.h" #include "txmempool.h" #include "ui_interface.h" @@ -3501,7 +3502,8 @@ { LOCK(pto->cs_inventory); vInv.reserve(std::max(pto->vInventoryBlockToSend.size(), - INVENTORY_BROADCAST_MAX)); + INVENTORY_BROADCAST_MAX_PER_MB * + MAX_SIZE / 1000000)); // Add blocks for (const uint256 &hash : pto->vInventoryBlockToSend) { @@ -3593,7 +3595,8 @@ unsigned int nRelayedTransactions = 0; LOCK(pto->cs_filter); while (!vInvTx.empty() && - nRelayedTransactions < INVENTORY_BROADCAST_MAX) { + nRelayedTransactions < + INVENTORY_BROADCAST_MAX_PER_MB * MAX_SIZE / 1000000) { // Fetch the top element from the heap std::pop_heap(vInvTx.begin(), vInvTx.end(), compareInvMempoolOrder); Index: src/validation.h =================================================================== --- src/validation.h +++ src/validation.h @@ -19,7 +19,7 @@ #include "fs.h" #include "protocol.h" // For CMessageHeader::MessageMagic #include "script/script_error.h" -#include "serialize.h" + #include "sync.h" #include "versionbits.h" @@ -143,8 +143,8 @@ * Maximum number of inventory items to send per transmission. * Limits the impact of low-fee transaction floods. */ -static const unsigned int INVENTORY_BROADCAST_MAX = - 7 * MAX_SIZE / 1000000 * INVENTORY_BROADCAST_INTERVAL; +static const unsigned int INVENTORY_BROADCAST_MAX_PER_MB = + 7 * INVENTORY_BROADCAST_INTERVAL; /** Average delay between feefilter broadcasts in seconds. */ static const unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; /** Maximum feefilter broadcast delay after significant change. */