mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-26 21:42:35 +01:00
Return a Result from verify_payment_id
This commit is contained in:
parent
33e69958e0
commit
fa6c0587e7
2 changed files with 3 additions and 3 deletions
|
@ -10900,7 +10900,7 @@ where
|
|||
|
||||
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,
|
||||
);
|
||||
|
|
|
@ -410,6 +410,6 @@ pub(crate) fn hmac_for_payment_id(
|
|||
|
||||
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(()) }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue