Skip to content

Commit fa6c058

Browse files
committed
Return a Result from verify_payment_id
1 parent 33e6995 commit fa6c058

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lightning/src/ln/channelmanager.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10900,7 +10900,7 @@ where
1090010900

1090110901
match context {
1090210902
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
10903-
if signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
10903+
if let Ok(()) = signer::verify_payment_id(payment_id, hmac, nonce, expanded_key) {
1090410904
self.abandon_payment_with_reason(
1090510905
payment_id, PaymentFailureReason::InvoiceRequestRejected,
1090610906
);

lightning/src/offers/signer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,6 @@ pub(crate) fn hmac_for_payment_id(
410410

411411
pub(crate) fn verify_payment_id(
412412
payment_id: PaymentId, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &ExpandedKey,
413-
) -> bool {
414-
hmac_for_payment_id(payment_id, nonce, expanded_key) == hmac
413+
) -> Result<(), ()> {
414+
if hmac_for_payment_id(payment_id, nonce, expanded_key) == hmac { Ok(()) } else { Err(()) }
415415
}

0 commit comments

Comments
 (0)