From c5d238a7b2c13807ec8b48be1a8d2d0fbb3a5ab3 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Thu, 19 Jan 2023 10:10:38 -0600 Subject: [PATCH] Make offers module public This is needed in order to fuzz test BOLT 12 message deserialization. --- lightning/src/lib.rs | 3 +-- lightning/src/offers/invoice.rs | 4 ++-- lightning/src/offers/invoice_request.rs | 2 +- lightning/src/offers/offer.rs | 2 +- lightning/src/offers/refund.rs | 2 +- lightning/src/util/ser_macros.rs | 3 +-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lightning/src/lib.rs b/lightning/src/lib.rs index d4289d07d..71f82ed01 100644 --- a/lightning/src/lib.rs +++ b/lightning/src/lib.rs @@ -78,8 +78,7 @@ extern crate core; pub mod util; pub mod chain; pub mod ln; -#[allow(unused)] -mod offers; +pub mod offers; pub mod routing; pub mod onion_message; diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index ad59bf35b..2d4b57d1a 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -16,7 +16,7 @@ //! The payment recipient must include a [`PaymentHash`], so as to reveal the preimage upon payment //! receipt, and one or more [`BlindedPath`]s for the payer to use when sending the payment. //! -//! ```ignore +//! ``` //! extern crate bitcoin; //! extern crate lightning; //! @@ -1462,7 +1462,7 @@ mod tests { .build().unwrap(); // Only standard addresses will be included. - let mut fallbacks = unsigned_invoice.invoice.fields_mut().fallbacks.as_mut().unwrap(); + let fallbacks = unsigned_invoice.invoice.fields_mut().fallbacks.as_mut().unwrap(); // Non-standard addresses fallbacks.push(FallbackAddress { version: 1, program: vec![0u8; 41] }); fallbacks.push(FallbackAddress { version: 2, program: vec![0u8; 1] }); diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index b0a8540b2..578b0a239 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -19,7 +19,7 @@ //! [`Invoice`]: crate::offers::invoice::Invoice //! [`Refund`]: crate::offers::refund::Refund //! -//! ```ignore +//! ``` //! extern crate bitcoin; //! extern crate lightning; //! diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs index a2008b6a0..a535b3782 100644 --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@ -13,7 +13,7 @@ //! published as a QR code to be scanned by a customer. The customer uses the offer to request an //! invoice from the merchant to be paid. //! -//! ```ignore +//! ``` //! extern crate bitcoin; //! extern crate core; //! extern crate lightning; diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs index d64f19db0..1488fbe97 100644 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@ -18,7 +18,7 @@ //! [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest //! [`Offer`]: crate::offers::offer::Offer //! -//! ```ignore +//! ``` //! extern crate bitcoin; //! extern crate core; //! extern crate lightning; diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index 0aefaf383..0a5c0b643 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -378,7 +378,6 @@ macro_rules! decode_tlv_stream_with_custom_tlv_decode { macro_rules! _decode_tlv_stream_range { ($stream: expr, $range: expr, $rewind: ident, {$(($type: expr, $field: ident, $fieldty: tt)),* $(,)*} $(, $decode_custom_tlv: expr)?) => { { - use core::ops::RangeBounds; use $crate::ln::msgs::DecodeError; let mut last_seen_type: Option = None; let mut stream_ref = $stream; @@ -401,7 +400,7 @@ macro_rules! _decode_tlv_stream_range { } }, Err(e) => return Err(e), - Ok(t) => if $range.contains(&t.0) { t } else { + Ok(t) => if core::ops::RangeBounds::contains(&$range, &t.0) { t } else { drop(tracking_reader); // Assumes the type id is minimally encoded, which is enforced on read. -- 2.39.5