]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix blinded payment TLV ser to not length-prefix
authorValentine Wallace <vwallace@protonmail.com>
Thu, 24 Aug 2023 19:23:06 +0000 (15:23 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Fri, 8 Sep 2023 14:43:02 +0000 (10:43 -0400)
impl_writeable_tlv_based includes a length prefix to the TLV stream, which we
don't want.

lightning/src/blinded_path/payment.rs

index 65af85eca4db88aec7366c6c27e6906b67e1e72b..b671fb919d5e650434b683dda0e8e63515fda736 100644 (file)
@@ -93,17 +93,27 @@ pub struct PaymentConstraints {
        pub htlc_minimum_msat: u64,
 }
 
-impl_writeable_tlv_based!(ForwardTlvs, {
-       (2, short_channel_id, required),
-       (10, payment_relay, required),
-       (12, payment_constraints, required),
-       (14, features, required),
-});
-
-impl_writeable_tlv_based!(ReceiveTlvs, {
-       (12, payment_constraints, required),
-       (65536, payment_secret, required),
-});
+impl Writeable for ForwardTlvs {
+       fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+               encode_tlv_stream!(w, {
+                       (2, self.short_channel_id, required),
+                       (10, self.payment_relay, required),
+                       (12, self.payment_constraints, required),
+                       (14, self.features, required)
+               });
+               Ok(())
+       }
+}
+
+impl Writeable for ReceiveTlvs {
+       fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+               encode_tlv_stream!(w, {
+                       (12, self.payment_constraints, required),
+                       (65536, self.payment_secret, required)
+               });
+               Ok(())
+       }
+}
 
 impl<'a> Writeable for BlindedPaymentTlvsRef<'a> {
        fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {