From 4c9ff4e7e6f2085a1980ca43a0e00a91a93b7836 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 17 Apr 2023 13:21:09 +1000 Subject: [PATCH] Allow each initial peer to send one inbound request before disconnecting any (#6520) --- zebrad/src/components/mempool/downloads.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zebrad/src/components/mempool/downloads.rs b/zebrad/src/components/mempool/downloads.rs index b397d7b7..9b29c186 100644 --- a/zebrad/src/components/mempool/downloads.rs +++ b/zebrad/src/components/mempool/downloads.rs @@ -78,7 +78,8 @@ pub(crate) const TRANSACTION_VERIFY_TIMEOUT: Duration = BLOCK_VERIFY_TIMEOUT; /// The maximum number of concurrent inbound download and verify tasks. /// /// We expect the mempool crawler to download and verify most mempool transactions, so this bound -/// can be small. +/// can be small. But it should be at least the default `network.peerset_initial_target_size` config, +/// to avoid disconnecting peers on startup. /// /// ## Security /// @@ -95,7 +96,9 @@ pub(crate) const TRANSACTION_VERIFY_TIMEOUT: Duration = BLOCK_VERIFY_TIMEOUT; /// Since Zebra keeps an `inv` index, inbound downloads for malicious transactions /// will be directed to the malicious node that originally gossiped the hash. /// Therefore, this attack can be carried out by a single malicious node. -pub const MAX_INBOUND_CONCURRENCY: usize = 10; +// +// TODO: replace with the configured value of network.peerset_initial_target_size +pub const MAX_INBOUND_CONCURRENCY: usize = 25; /// A marker struct for the oneshot channels which cancel a pending download and verify. #[derive(Copy, Clone, Debug, Eq, PartialEq)]