@@ -2561,6 +2561,10 @@ mod tests {
25612561
25622562 use crate :: blinded_path:: EmptyNodeIdLookUp ;
25632563 use crate :: events:: { Event , PathFailure , PaymentFailureReason } ;
2564+ use crate :: offers:: static_invoice:: { StaticInvoiceBuilder , StaticInvoice } ;
2565+ use crate :: blinded_path:: message:: BlindedMessagePath ;
2566+ use crate :: ln:: outbound_payment:: tests:: test_utils:: pubkey;
2567+ use crate :: blinded_path:: BlindedHop ;
25642568 use crate :: types:: payment:: { PaymentHash , PaymentPreimage } ;
25652569 use crate :: ln:: channelmanager:: { PaymentId , RecipientOnionFields } ;
25662570 use crate :: ln:: inbound_payment:: ExpandedKey ;
@@ -3138,6 +3142,46 @@ mod tests {
31383142 . unwrap ( )
31393143 }
31403144
3145+ fn blinded_path ( ) -> BlindedMessagePath {
3146+ BlindedMessagePath :: from_raw (
3147+ pubkey ( 40 ) ,
3148+ pubkey ( 41 ) ,
3149+ vec ! [
3150+ BlindedHop { blinded_node_id: pubkey( 42 ) , encrypted_payload: vec![ 0 ; 43 ] } ,
3151+ BlindedHop { blinded_node_id: pubkey( 43 ) , encrypted_payload: vec![ 0 ; 44 ] } ,
3152+ ] ,
3153+ )
3154+ }
3155+
3156+ // FIXME(vincenzopalazzo): This function is duplicated with the one in static_invoive.rs
3157+ fn dummy_static_invoice ( ) -> StaticInvoice {
3158+ let node_id = recipient_pubkey ( ) ;
3159+ let payment_paths = payment_paths ( ) ;
3160+ let now = now ( ) ;
3161+ let expanded_key = ExpandedKey :: new ( [ 42 ; 32 ] ) ;
3162+ let entropy = FixedEntropy { } ;
3163+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
3164+ let secp_ctx = Secp256k1 :: new ( ) ;
3165+
3166+ let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
3167+ . path ( blinded_path ( ) )
3168+ . build ( )
3169+ . unwrap ( ) ;
3170+
3171+ StaticInvoiceBuilder :: for_offer_using_derived_keys (
3172+ & offer,
3173+ payment_paths. clone ( ) ,
3174+ vec ! [ blinded_path( ) ] ,
3175+ now,
3176+ & expanded_key,
3177+ nonce,
3178+ & secp_ctx,
3179+ )
3180+ . unwrap ( )
3181+ . build_and_sign ( & secp_ctx)
3182+ . unwrap ( )
3183+ }
3184+
31413185 #[ test]
31423186 fn time_out_unreleased_async_payments ( ) {
31433187 let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
@@ -3160,6 +3204,7 @@ mod tests {
31603204 retry_strategy : Retry :: Attempts ( 0 ) ,
31613205 route_params,
31623206 invoice_request : dummy_invoice_request ( ) ,
3207+ static_invoice : dummy_static_invoice ( ) ,
31633208 } ;
31643209 outbounds. insert ( payment_id, outbound) ;
31653210 core:: mem:: drop ( outbounds) ;
@@ -3207,6 +3252,7 @@ mod tests {
32073252 retry_strategy : Retry :: Attempts ( 0 ) ,
32083253 route_params,
32093254 invoice_request : dummy_invoice_request ( ) ,
3255+ static_invoice : dummy_static_invoice ( ) ,
32103256 } ;
32113257 outbounds. insert ( payment_id, outbound) ;
32123258 core:: mem:: drop ( outbounds) ;
0 commit comments