Merge pull request #2949 from valentinewallace/2024-03-dont-write-empty-features
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Wed, 20 Mar 2024 00:52:59 +0000 (00:52 +0000)
committerGitHub <noreply@github.com>
Wed, 20 Mar 2024 00:52:59 +0000 (00:52 +0000)
Only write `BlindedHopFeatures` if any features are set

lightning/src/blinded_path/payment.rs

index 0ed09a366d8be7075415b92abad585a51fad6c9b..6467af568886bd1891a7e8c52ae6b5956736f6bd 100644 (file)
@@ -120,11 +120,14 @@ impl TryFrom<CounterpartyForwardingInfo> for PaymentRelay {
 
 impl Writeable for ForwardTlvs {
        fn write<W: Writer>(&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(())
        }