From 286775626303e76e43cd9d06b0390733daf4faaf Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 4 Nov 2024 11:18:23 +0000 Subject: [PATCH] ConnID: With quadruple_size, support the maximum easy lengths --- shared/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 6c356810..d900924f 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -92,7 +92,12 @@ pub const MAX_EAD_SIZE_LEN: usize = SCALE_FACTOR * 64; /// Maximum length of a [`ConnId`] (`C_x`). /// /// This length includes the leading CBOR encoding byte(s). -const MAX_CONNID_ENCODED_LEN: usize = 8; +// If ints had a const `.clamp()` feature, this could be (8 * SCALE_FACTOR).clamp(1, 23). +const MAX_CONNID_ENCODED_LEN: usize = if cfg!(feature = "quadruple_sizes") { + 24 +} else { + 8 +}; pub type BytesSuites = [u8; SUITES_LEN]; pub type BytesSupportedSuites = [u8; SUPPORTED_SUITES_LEN];