match context {
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
- if signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
+ if let Ok(()) = signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
self.abandon_payment_with_reason(
payment_id, PaymentFailureReason::InvoiceRequestRejected,
);
pub(crate) fn verify_payment_id(
payment_id: PaymentId, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &ExpandedKey,
-) -> bool {
- hmac_for_payment_id(payment_id, nonce, expanded_key) == hmac
+) -> Result<(), ()> {
+ if hmac_for_payment_id(payment_id, nonce, expanded_key) == hmac { Ok(()) } else { Err(()) }
}