Skip to content

Commit 9dba36a

Browse files
Fix blinded hop feature serialization.
We were writing a length redundantly...
1 parent f68b124 commit 9dba36a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::offers::invoice_request::InvoiceRequestFields;
2626
use crate::offers::offer::OfferId;
2727
use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph};
2828
use crate::sign::{EntropySource, NodeSigner, Recipient};
29-
use crate::util::ser::{FixedLengthReader, LengthReadableArgs, HighZeroBytesDroppedBigSize, Readable, Writeable, Writer};
29+
use crate::util::ser::{FixedLengthReader, LengthReadableArgs, HighZeroBytesDroppedBigSize, Readable, WithoutLength, Writeable, Writer};
3030

3131
use core::mem;
3232
use core::ops::Deref;
@@ -344,7 +344,7 @@ impl Writeable for ForwardTlvs {
344344
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
345345
let features_opt =
346346
if self.features == BlindedHopFeatures::empty() { None }
347-
else { Some(&self.features) };
347+
else { Some(WithoutLength(&self.features)) };
348348
encode_tlv_stream!(w, {
349349
(2, self.short_channel_id, required),
350350
(10, self.payment_relay, required),
@@ -385,7 +385,7 @@ impl Readable for BlindedPaymentTlvs {
385385
(8, next_blinding_override, option),
386386
(10, payment_relay, option),
387387
(12, payment_constraints, required),
388-
(14, features, option),
388+
(14, features, (option, encoding: (BlindedHopFeatures, WithoutLength))),
389389
(65536, payment_secret, option),
390390
(65537, payment_context, (default_value, PaymentContext::unknown())),
391391
});

lightning/src/ln/features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl_feature_write_without_length!(Bolt12InvoiceFeatures);
9898
impl_feature_write_without_length!(ChannelTypeFeatures);
9999
impl_feature_write_without_length!(InvoiceRequestFeatures);
100100
impl_feature_write_without_length!(OfferFeatures);
101+
impl_feature_write_without_length!(BlindedHopFeatures);
101102

102103
#[cfg(test)]
103104
mod tests {

0 commit comments

Comments
 (0)