Derive a PartialEq and Eq for PaymentError
authorbenthecarman <benthecarman@live.com>
Tue, 23 May 2023 21:18:39 +0000 (16:18 -0500)
committerbenthecarman <benthecarman@live.com>
Wed, 24 May 2023 22:40:48 +0000 (17:40 -0500)
This lets users compare error types more easily without needing a match
statement.

lightning-invoice/src/payment.rs
lightning/src/ln/outbound_payment.rs

index c08a00a0ca23ec18f31fcfbbe1afca9aff6ba57e..7abfbe4bfc4e7201d03bcdabafcd023d28f7cb3a 100644 (file)
@@ -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),
index f107f3b558395fe7ea9da8f8a8194f8f52a9f634..a13a618d83c4c2b0e8988f6103a1a26c2fcb2d63 100644 (file)
@@ -312,7 +312,7 @@ impl<T: Time> Display for PaymentAttemptsUsingTime<T> {
 /// [`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`].