From ef9f4aa4ef557f1f12f563d9f2760ae2e384594a Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Fri, 10 Oct 2025 15:54:27 +0100 Subject: [PATCH] Greatly reduce size on stack of addr tables Limited systems, or otherwise conserative operating systems, may limit the stack size of the thread that the node operates on. Most light clients will not store more than a few hundred peers and even fewer will have tried more than a handful during any given sync session. This reduces the stack size of the table to a far more conservative size so as to avoid a stack overflow. --- src/network/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/mod.rs b/src/network/mod.rs index 40b8bc80..408b98ea 100644 --- a/src/network/mod.rs +++ b/src/network/mod.rs @@ -45,13 +45,13 @@ const SEND_PING: Duration = Duration::from_secs(60 * 2); const MAX_FILTER_RESPONSE_TIME_SEC: Duration = Duration::from_secs(20); // These are the parameters of the "tried" and "new" tables -const B_TRIED: usize = 64; +const B_TRIED: usize = 4; const S_TRIED: usize = 16; -const W_TRIED: usize = 16; +const W_TRIED: usize = 2; -const B_NEW: usize = 128; +const B_NEW: usize = 16; const S_NEW: usize = 16; -const W_NEW: usize = 16; +const W_NEW: usize = 8; // Maximum occurrences of a single network address const MAX_ADDR: usize = 4;