From: Jeffrey Czyz Date: Wed, 8 Feb 2023 00:29:08 +0000 (-0600) Subject: Derive traits for InvoiceRequest and Invoice X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6be30f98bdca6ae4abe4c4476dfbf66ae94e9dfa;p=rust-lightning Derive traits for InvoiceRequest and Invoice Offer and Refund derive Debug, Clone, and PartialEq. For consistency, derive these traits for InvoiceRequest and Invoice as well. --- diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 64d4c5d3d..d1b1e99ba 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -307,6 +307,7 @@ impl<'a> UnsignedInvoice<'a> { /// [`Offer`]: crate::offers::offer::Offer /// [`Refund`]: crate::offers::refund::Refund /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +#[derive(Clone, Debug, PartialEq)] pub struct Invoice { bytes: Vec, contents: InvoiceContents, @@ -317,6 +318,7 @@ pub struct Invoice { /// /// [`Offer`]: crate::offers::offer::Offer /// [`Refund`]: crate::offers::refund::Refund +#[derive(Clone, Debug, PartialEq)] enum InvoiceContents { /// Contents for an [`Invoice`] corresponding to an [`Offer`]. /// @@ -335,6 +337,7 @@ enum InvoiceContents { } /// Invoice-specific fields for an `invoice` message. +#[derive(Clone, Debug, PartialEq)] struct InvoiceFields { payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, created_at: Duration, diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index 578b0a239..cc397f0f9 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -250,7 +250,7 @@ impl<'a> UnsignedInvoiceRequest<'a> { /// /// [`Invoice`]: crate::offers::invoice::Invoice /// [`Offer`]: crate::offers::offer::Offer -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub struct InvoiceRequest { pub(super) bytes: Vec, pub(super) contents: InvoiceRequestContents, @@ -260,7 +260,7 @@ pub struct InvoiceRequest { /// The contents of an [`InvoiceRequest`], which may be shared with an [`Invoice`]. /// /// [`Invoice`]: crate::offers::invoice::Invoice -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub(super) struct InvoiceRequestContents { payer: PayerContents, pub(super) offer: OfferContents,