From 5d0a9821e24ba28d8d68835794d6e90ddf91d19f Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Thu, 24 Aug 2023 15:23:06 -0400 Subject: [PATCH] Fix blinded payment TLV ser to not length-prefix impl_writeable_tlv_based includes a length prefix to the TLV stream, which we don't want. --- lightning/src/blinded_path/payment.rs | 30 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index 2a6c5e3c50e..271aa30c16b 100644 --- a/lightning/src/blinded_path/payment.rs +++ b/lightning/src/blinded_path/payment.rs @@ -88,17 +88,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 for ForwardTlvs { + fn write(&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_tlv_based!(ReceiveTlvs, { - (12, payment_constraints, required), - (65536, payment_secret, required), -}); +impl Writeable for ReceiveTlvs { + fn write(&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(&self, w: &mut W) -> Result<(), io::Error> {