- fn mark_abandoned(&mut self) -> Result<(), ()> {
- let mut session_privs = HashSet::new();
- let our_payment_hash;
- core::mem::swap(&mut session_privs, match self {
- PendingOutboundPayment::Legacy { .. } |
- PendingOutboundPayment::Fulfilled { .. } =>
- return Err(()),
- PendingOutboundPayment::Retryable { session_privs, payment_hash, .. } |
- PendingOutboundPayment::Abandoned { session_privs, payment_hash, .. } => {
- our_payment_hash = *payment_hash;
- session_privs
- },
- });
- *self = PendingOutboundPayment::Abandoned { session_privs, payment_hash: our_payment_hash };
- Ok(())
+ fn mark_abandoned(&mut self, reason: PaymentFailureReason) {
+ if let PendingOutboundPayment::Retryable { session_privs, payment_hash, .. } = self {
+ let mut our_session_privs = HashSet::new();
+ core::mem::swap(&mut our_session_privs, session_privs);
+ *self = PendingOutboundPayment::Abandoned {
+ session_privs: our_session_privs,
+ payment_hash: *payment_hash,
+ reason: Some(reason)
+ };
+ }