From: Valentine Wallace Date: Tue, 19 Mar 2024 18:58:43 +0000 (-0400) Subject: Only write BlindedHopFeatures if any features are set. X-Git-Tag: v0.0.123-beta~37^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=caccb1cc21ad85d9a38f1876880843044b0ad6cf;p=rust-lightning Only write BlindedHopFeatures if any features are set. Minor space-saving optimization. --- diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index 0ed09a366..6467af568 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(()) }