Derive traits for InvoiceRequest and Invoice
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 8 Feb 2023 00:29:08 +0000 (18:29 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 21 Feb 2023 20:07:51 +0000 (14:07 -0600)
Offer and Refund derive Debug, Clone, and PartialEq. For consistency,
derive these traits for InvoiceRequest and Invoice as well.

lightning/src/offers/invoice.rs
lightning/src/offers/invoice_request.rs

index 64d4c5d3dce3e03a2e23c9d45ba848f1ddc352d8..d1b1e99bad381b32ace7aa9c86d974e86fb79bf8 100644 (file)
@@ -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<u8>,
        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,
index 578b0a2398e5aee05410a97b5d06250ca8f52e23..cc397f0f9a852f2c2cc5ea762ab7dc95338fb5d1 100644 (file)
@@ -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<u8>,
        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,