UnexpectedError,
/// An invoice was received that required unknown features.
UnknownRequiredFeatures,
+ /// A [`Bolt12Invoice`] was not received in a reasonable amount of time.
+ InvoiceRequestExpired,
}
impl_writeable_tlv_based_enum!(PaymentFailureReason,
(0, RecipientRejected) => {},
(1, UnknownRequiredFeatures) => {},
(2, UserAbandoned) => {},
+ (3, InvoiceRequestExpired) => {},
(4, RetriesExhausted) => {},
(6, PaymentExpired) => {},
(8, RouteNotFound) => {},
/// [`Offer`]: crate::offers::offer::Offer
payment_hash: Option<PaymentHash>,
/// The reason the payment failed. This is only `None` for events generated or serialized
- /// by versions prior to 0.0.115 or when deserializing an `Event::InvoiceRequestFailed`,
- /// which was removed in 0.0.124.
+ /// by versions prior to 0.0.115.
reason: Option<PaymentFailureReason>,
},
/// Indicates that a path for an outbound payment was successful.
Ok(Some(Event::PaymentFailed {
payment_id: payment_id.0.unwrap(),
payment_hash: None,
- reason: None,
+ reason: Some(PaymentFailureReason::InvoiceRequestExpired),
}))
};
f()
let event = events::Event::PaymentFailed {
payment_id: *payment_id,
payment_hash: None,
- reason: None,
+ reason: Some(PaymentFailureReason::InvoiceRequestExpired),
};
pending_events.push_back((event, None));
false
assert!(!pending_events.lock().unwrap().is_empty());
assert_eq!(
pending_events.lock().unwrap().pop_front(),
- Some((Event::PaymentFailed { payment_id, payment_hash: None, reason: None }, None)),
+ Some((Event::PaymentFailed {
+ payment_id,
+ payment_hash: None,
+ reason: Some(PaymentFailureReason::InvoiceRequestExpired),
+ }, None)),
);
assert!(pending_events.lock().unwrap().is_empty());
assert!(!pending_events.lock().unwrap().is_empty());
assert_eq!(
pending_events.lock().unwrap().pop_front(),
- Some((Event::PaymentFailed { payment_id, payment_hash: None, reason: None }, None)),
+ Some((Event::PaymentFailed {
+ payment_id,
+ payment_hash: None,
+ reason: Some(PaymentFailureReason::InvoiceRequestExpired),
+ }, None)),
);
assert!(pending_events.lock().unwrap().is_empty());