@@ -51,7 +51,7 @@ use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, Paym
5151use crate :: blinded_path:: message:: OffersContext ;
5252use crate :: events:: { ClosureReason , Event , HTLCHandlingFailureType , PaidBolt12Invoice , PaymentFailureReason , PaymentPurpose } ;
5353use crate :: ln:: channelmanager:: { self , Bolt12PaymentError , OptionalOfferPaymentParams , PaymentId , RecentPaymentDetails , RecipientOnionFields , Retry } ;
54- use crate :: offers:: contacts:: ContactSecrets ;
54+ use crate :: offers:: contacts:: { compute_contact_secret , ContactSecrets } ;
5555use crate :: offers:: offer:: Offer ;
5656use crate :: types:: features:: Bolt12InvoiceFeatures ;
5757use crate :: ln:: functional_test_utils:: * ;
@@ -2564,8 +2564,22 @@ fn pay_offer_and_add_contacts_info_blip42() {
25642564 assert_ne ! ( offer. issuer_signing_pubkey( ) , Some ( alice_id) ) ;
25652565 assert ! ( !offer. paths( ) . is_empty( ) ) ;
25662566
2567+ // Compute Bob's contact secret for BLIP-42 contact management
2568+ // Bob is node 1, so his seed is [1u8; 32]
2569+ let bob_seed = [ 1u8 ; 32 ] ;
2570+ let secp_ctx = Secp256k1 :: new ( ) ;
2571+ let bob_master_key = bitcoin:: bip32:: Xpriv :: new_master ( Network :: Testnet , & bob_seed) . unwrap ( ) ;
2572+ let bob_private_key = bob_master_key
2573+ . derive_priv ( & secp_ctx, & bitcoin:: bip32:: ChildNumber :: Hardened { index : 0 } )
2574+ . expect ( "derivation failed" )
2575+ . private_key ;
2576+ let bob_contact_secrets = compute_contact_secret ( & bob_private_key, & offer) ;
2577+
25672578 let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
2568- bob. node . pay_for_offer ( & offer, None , payment_id, Default :: default ( ) ) . unwrap ( ) ;
2579+ bob. node . pay_for_offer ( & offer, None , payment_id, OptionalOfferPaymentParams {
2580+ contact_secrects : Some ( bob_contact_secrets) ,
2581+ ..Default :: default ( )
2582+ } ) . unwrap ( ) ;
25692583
25702584 expect_recent_payment ! ( bob, RecentPaymentDetails :: AwaitingInvoice , payment_id) ;
25712585 let onion_message = bob. onion_messenger . next_onion_message_for_peer ( alice_id) . unwrap ( ) ;
0 commit comments