From b81f37031c8f2ccad9346f1b65ee0f8083c44796 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Thu, 5 Oct 2023 11:20:04 +1000 Subject: [PATCH] p2p: Increase tx relay rate In the presence of smaller transactions on the network, blocks can sustain a higher relay rate than 7tx/second. In this event, the per-peer inventory queues can grow too large. This commit bumps the rate up to 14 tx/s (for inbound peers), increasing the safety margin by a factor of 2. Outbound peers continue to receive relayed transactions at 2.5x the rate of inbound peers, for a rate of 35tx/second. Co-Authored-By: Suhas Daftuar --- 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 e503a683827..f71378295b3 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -136,7 +136,7 @@ static constexpr auto INBOUND_INVENTORY_BROADCAST_INTERVAL{5s}; static constexpr auto OUTBOUND_INVENTORY_BROADCAST_INTERVAL{2s}; /** Maximum rate of inventory items to send per second. * Limits the impact of low-fee transaction floods. */ -static constexpr unsigned int INVENTORY_BROADCAST_PER_SECOND = 7; +static constexpr unsigned int INVENTORY_BROADCAST_PER_SECOND{14}; /** Target number of tx inventory items to send per transmission. */ static constexpr unsigned int INVENTORY_BROADCAST_TARGET = INVENTORY_BROADCAST_PER_SECOND * count_seconds(INBOUND_INVENTORY_BROADCAST_INTERVAL); /** Maximum number of inventory items to send per transmission. */