@@ -16,7 +16,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
16
16
use bitcoin:: secp256k1:: { Keypair , PublicKey , Secp256k1 , SecretKey , self } ;
17
17
use types:: payment:: PaymentHash ;
18
18
use core:: fmt;
19
- use crate :: blinded_path:: payment:: PaymentContext ;
19
+ use crate :: blinded_path:: payment:: ReceiveTlvs ;
20
20
use crate :: ln:: channelmanager:: PaymentId ;
21
21
use crate :: ln:: inbound_payment:: { ExpandedKey , IV_LEN } ;
22
22
use crate :: offers:: merkle:: TlvRecord ;
@@ -47,8 +47,8 @@ const ASYNC_PAYMENT_ID_HMAC_INPUT: &[u8; 16] = &[6; 16];
47
47
// HMAC input for a `PaymentHash`. The HMAC is used in `OffersContext::InboundPayment`.
48
48
const PAYMENT_HASH_HMAC_INPUT : & [ u8 ; 16 ] = & [ 7 ; 16 ] ;
49
49
50
- // HMAC input for a `PaymentContext `. The HMAC is used in `blinded_path::payment::ReceiveTlvs `.
51
- const PAYMENT_CONTEXT_HMAC_INPUT : & [ u8 ; 16 ] = & [ 8 ; 16 ] ;
50
+ // HMAC input for `ReceiveTlvs `. The HMAC is used in `blinded_path::payment::PaymentContext `.
51
+ const PAYMENT_TLVS_HMAC_INPUT : & [ u8 ; 16 ] = & [ 8 ; 16 ] ;
52
52
53
53
/// Message metadata which possibly is derived from [`MetadataMaterial`] such that it can be
54
54
/// verified.
@@ -464,21 +464,21 @@ fn hmac_for_payment_id(
464
464
Hmac :: from_engine ( hmac)
465
465
}
466
466
467
- pub ( crate ) fn hmac_for_payment_context (
468
- payment_context : & PaymentContext , nonce : Nonce , expanded_key : & ExpandedKey ,
467
+ pub ( crate ) fn hmac_for_payment_tlvs (
468
+ receive_tlvs : & ReceiveTlvs , nonce : Nonce , expanded_key : & ExpandedKey ,
469
469
) -> Hmac < Sha256 > {
470
- const IV_BYTES : & [ u8 ; IV_LEN ] = b"LDK Payment ~~~~ " ;
470
+ const IV_BYTES : & [ u8 ; IV_LEN ] = b"LDK Payment TLVs " ;
471
471
let mut hmac = expanded_key. hmac_for_offer ( ) ;
472
472
hmac. input ( IV_BYTES ) ;
473
473
hmac. input ( & nonce. 0 ) ;
474
- hmac. input ( PAYMENT_CONTEXT_HMAC_INPUT ) ;
475
- payment_context . write ( & mut hmac) . unwrap ( ) ;
474
+ hmac. input ( PAYMENT_TLVS_HMAC_INPUT ) ;
475
+ receive_tlvs . write ( & mut hmac) . unwrap ( ) ;
476
476
477
477
Hmac :: from_engine ( hmac)
478
478
}
479
479
480
- pub ( crate ) fn verify_payment_context (
481
- payment_context : & PaymentContext , hmac : Hmac < Sha256 > , nonce : Nonce , expanded_key : & ExpandedKey ,
480
+ pub ( crate ) fn verify_payment_tlvs (
481
+ receive_tlvs : & ReceiveTlvs , hmac : Hmac < Sha256 > , nonce : Nonce , expanded_key : & ExpandedKey ,
482
482
) -> Result < ( ) , ( ) > {
483
- if hmac_for_payment_context ( payment_context , nonce, expanded_key) == hmac { Ok ( ( ) ) } else { Err ( ( ) ) }
483
+ if hmac_for_payment_tlvs ( receive_tlvs , nonce, expanded_key) == hmac { Ok ( ( ) ) } else { Err ( ( ) ) }
484
484
}
0 commit comments