From caccb1cc21ad85d9a38f1876880843044b0ad6cf Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 19 Mar 2024 14:58:43 -0400 Subject: [PATCH] Only write BlindedHopFeatures if any features are set. Minor space-saving optimization. --- lightning/src/blinded_path/payment.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index 0ed09a36..6467af56 100644 --- a/lightning/src/blinded_path/payment.rs +++ b/lightning/src/blinded_path/payment.rs @@ -120,11 +120,14 @@ impl TryFrom for PaymentRelay { impl Writeable for ForwardTlvs { fn write(&self, w: &mut W) -> Result<(), io::Error> { + let features_opt = + if self.features == BlindedHopFeatures::empty() { None } + else { Some(&self.features) }; encode_tlv_stream!(w, { (2, self.short_channel_id, required), (10, self.payment_relay, required), (12, self.payment_constraints, required), - (14, self.features, required) + (14, features_opt, option) }); Ok(()) } -- 2.30.2