Skip to content

Commit

Permalink
Fix blinded payment TLV ser to not length-prefix
Browse files Browse the repository at this point in the history
impl_writeable_tlv_based includes a length prefix to the TLV stream, which we
don't want.
  • Loading branch information
valentinewallace committed Sep 6, 2023
1 parent 7415bef commit 4777c29
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lightning/src/blinded_path/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,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<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_tlv_based!(ReceiveTlvs, {
(12, payment_constraints, required),
(65536, payment_secret, required),
});
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> {
Expand Down

0 comments on commit 4777c29

Please sign in to comment.