From 0acd5d3e46b307f5a34bc8ef5286bf1b5a58a37e Mon Sep 17 00:00:00 2001 From: Omer Yacine Date: Wed, 2 Nov 2022 17:32:47 +0200 Subject: [PATCH] Fix an incorrect assertion in tlv stream encoding Types must be unique and monotonically increasing (using < instead of <=) --- lightning/src/util/ser_macros.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index 2ed3683f4..d137b0f67 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -55,7 +55,8 @@ macro_rules! _check_encoded_tlv_order { ($last_type: expr, $type: expr, (static_value, $value: expr)) => { }; ($last_type: expr, $type: expr, $fieldty: tt) => { if let Some(t) = $last_type { - debug_assert!(t <= $type); + #[allow(unused_comparisons)] // Note that $type may be 0 making the following comparison always false + (debug_assert!(t < $type)) } $last_type = Some($type); }; -- 2.39.5