Skip to content

Commit 2c566c6

Browse files
committed
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.
1 parent 70b3f2e commit 2c566c6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lightning/src/offers/invoice.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ impl<'a> UnsignedInvoice<'a> {
307307
/// [`Offer`]: crate::offers::offer::Offer
308308
/// [`Refund`]: crate::offers::refund::Refund
309309
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
310+
#[derive(Clone, Debug, PartialEq)]
310311
pub struct Invoice {
311312
bytes: Vec<u8>,
312313
contents: InvoiceContents,
@@ -317,6 +318,7 @@ pub struct Invoice {
317318
///
318319
/// [`Offer`]: crate::offers::offer::Offer
319320
/// [`Refund`]: crate::offers::refund::Refund
321+
#[derive(Clone, Debug, PartialEq)]
320322
enum InvoiceContents {
321323
/// Contents for an [`Invoice`] corresponding to an [`Offer`].
322324
///
@@ -335,6 +337,7 @@ enum InvoiceContents {
335337
}
336338

337339
/// Invoice-specific fields for an `invoice` message.
340+
#[derive(Clone, Debug, PartialEq)]
338341
struct InvoiceFields {
339342
payment_paths: Vec<(BlindedPath, BlindedPayInfo)>,
340343
created_at: Duration,

lightning/src/offers/invoice_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a> UnsignedInvoiceRequest<'a> {
250250
///
251251
/// [`Invoice`]: crate::offers::invoice::Invoice
252252
/// [`Offer`]: crate::offers::offer::Offer
253-
#[derive(Clone, Debug)]
253+
#[derive(Clone, Debug, PartialEq)]
254254
pub struct InvoiceRequest {
255255
pub(super) bytes: Vec<u8>,
256256
pub(super) contents: InvoiceRequestContents,
@@ -260,7 +260,7 @@ pub struct InvoiceRequest {
260260
/// The contents of an [`InvoiceRequest`], which may be shared with an [`Invoice`].
261261
///
262262
/// [`Invoice`]: crate::offers::invoice::Invoice
263-
#[derive(Clone, Debug)]
263+
#[derive(Clone, Debug, PartialEq)]
264264
pub(super) struct InvoiceRequestContents {
265265
payer: PayerContents,
266266
pub(super) offer: OfferContents,

0 commit comments

Comments
 (0)