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.
This commit is contained in:
Valentine Wallace 2023-08-24 15:23:06 -04:00
parent 10a159f71e
commit d5925f210e
No known key found for this signature in database
GPG key ID: FD3E106A2CE099B4

View file

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