diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 6cb37ab53..8fd9ab980 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -1237,7 +1237,7 @@ impl TryFrom> for Bolt12Invoice { /// Valid type range for invoice TLV records. pub(super) const INVOICE_TYPES: core::ops::Range = 160..240; -tlv_stream!(InvoiceTlvStream, InvoiceTlvStreamRef, INVOICE_TYPES, { +tlv_stream!(InvoiceTlvStream, InvoiceTlvStreamRef<'a>, INVOICE_TYPES, { (160, paths: (Vec, WithoutLength, Iterable<'a, BlindedPathIter<'a>, BlindedPath>)), (162, blindedpay: (Vec, WithoutLength, Iterable<'a, BlindedPayInfoIter<'a>, BlindedPayInfo>)), (164, created_at: (u64, HighZeroBytesDroppedBigSize)), diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index e33ccb616..4d5c37bba 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -1061,7 +1061,7 @@ pub(super) const INVOICE_REQUEST_PAYER_ID_TYPE: u64 = 88; // This TLV stream is used for both InvoiceRequest and Refund, but not all TLV records are valid for // InvoiceRequest as noted below. -tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef, INVOICE_REQUEST_TYPES, { +tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef<'a>, INVOICE_REQUEST_TYPES, { (80, chain: ChainHash), (82, amount: (u64, HighZeroBytesDroppedBigSize)), (84, features: (InvoiceRequestFeatures, WithoutLength)), diff --git a/lightning/src/offers/merkle.rs b/lightning/src/offers/merkle.rs index e2fed2e80..15d6aabab 100644 --- a/lightning/src/offers/merkle.rs +++ b/lightning/src/offers/merkle.rs @@ -21,7 +21,7 @@ use crate::prelude::*; /// Valid type range for signature TLV records. const SIGNATURE_TYPES: core::ops::RangeInclusive = 240..=1000; -tlv_stream!(SignatureTlvStream, SignatureTlvStreamRef, SIGNATURE_TYPES, { +tlv_stream!(SignatureTlvStream, SignatureTlvStreamRef<'a>, SIGNATURE_TYPES, { (240, signature: Signature), }); diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs index 546d42b88..4caa3757a 100644 --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@ -1077,7 +1077,7 @@ const OFFER_METADATA_TYPE: u64 = 4; /// TLV record type for [`Offer::issuer_signing_pubkey`]. const OFFER_ISSUER_ID_TYPE: u64 = 22; -tlv_stream!(OfferTlvStream, OfferTlvStreamRef, OFFER_TYPES, { +tlv_stream!(OfferTlvStream, OfferTlvStreamRef<'a>, OFFER_TYPES, { (2, chains: (Vec, WithoutLength)), (OFFER_METADATA_TYPE, metadata: (Vec, WithoutLength)), (6, currency: CurrencyCode), diff --git a/lightning/src/offers/payer.rs b/lightning/src/offers/payer.rs index 0ec5721dc..696eac240 100644 --- a/lightning/src/offers/payer.rs +++ b/lightning/src/offers/payer.rs @@ -30,6 +30,6 @@ pub(super) struct PayerContents(pub Metadata); /// [`Refund::payer_metadata`]: crate::offers::refund::Refund::payer_metadata pub(super) const PAYER_METADATA_TYPE: u64 = 0; -tlv_stream!(PayerTlvStream, PayerTlvStreamRef, 0..1, { +tlv_stream!(PayerTlvStream, PayerTlvStreamRef<'a>, 0..1, { (PAYER_METADATA_TYPE, metadata: (Vec, WithoutLength)), }); diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index d4428697b..0703aac9e 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -952,7 +952,7 @@ macro_rules! impl_writeable_tlv_based { /// [`Readable`]: crate::util::ser::Readable /// [`Writeable`]: crate::util::ser::Writeable macro_rules! tlv_stream { - ($name:ident, $nameref:ident, $range:expr, { + ($name:ident, $nameref:ident $(<$lifetime:lifetime>)?, $range:expr, { $(($type:expr, $field:ident : $fieldty:tt)),* $(,)* }) => { #[derive(Debug)] @@ -964,13 +964,13 @@ macro_rules! tlv_stream { #[cfg_attr(test, derive(PartialEq))] #[derive(Debug)] - pub(crate) struct $nameref<'a> { + pub(crate) struct $nameref<$($lifetime)*> { $( pub(super) $field: Option, )* } - impl<'a> $crate::util::ser::Writeable for $nameref<'a> { + impl<$($lifetime)*> $crate::util::ser::Writeable for $nameref<$($lifetime)*> { fn write(&self, writer: &mut W) -> Result<(), $crate::io::Error> { encode_tlv_stream!(writer, { $(($type, self.$field, (option, encoding: $fieldty))),*