From 9a657092396de98aa220149a5fbfd8dbded8512a Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 7 Feb 2023 18:29:08 -0600 Subject: [PATCH] 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. --- lightning/src/offers/invoice.rs | 3 +++ lightning/src/offers/invoice_request.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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, -- 2.39.5