From: benthecarman Date: Tue, 23 May 2023 21:18:39 +0000 (-0500) Subject: Derive a PartialEq and Eq for PaymentError X-Git-Tag: v0.0.116-alpha1~29^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=3003f7d71991d3887f21048030f8b946fc5d4943;p=rust-lightning Derive a PartialEq and Eq for PaymentError This lets users compare error types more easily without needing a match statement. --- diff --git a/lightning-invoice/src/payment.rs b/lightning-invoice/src/payment.rs index c08a00a0c..7abfbe4bf 100644 --- a/lightning-invoice/src/payment.rs +++ b/lightning-invoice/src/payment.rs @@ -169,7 +169,7 @@ fn expiry_time_from_unix_epoch(invoice: &Invoice) -> Duration { } /// An error that may occur when making a payment. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum PaymentError { /// An error resulting from the provided [`Invoice`] or payment hash. Invoice(&'static str), diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index f107f3b55..a13a618d8 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -312,7 +312,7 @@ impl Display for PaymentAttemptsUsingTime { /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum RetryableSendFailure { /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note /// that this error is *not* caused by [`Retry::Timeout`].