@@ -403,7 +403,15 @@ impl OutboundPayments {
403403 }
404404 }
405405
406- pub ( super ) fn add_new_pending_payment < K : Deref > (
406+ #[ cfg( test) ]
407+ pub ( super ) fn test_add_new_pending_payment < K : Deref > (
408+ & self , payment_hash : PaymentHash , payment_secret : Option < PaymentSecret > , payment_id : PaymentId ,
409+ route : & Route , keys_manager : & K , best_block_height : u32
410+ ) -> Result < Vec < [ u8 ; 32 ] > , PaymentSendFailure > where K :: Target : KeysInterface {
411+ self . add_new_pending_payment ( payment_hash, payment_secret, payment_id, route, keys_manager, best_block_height)
412+ }
413+
414+ fn add_new_pending_payment < K : Deref > (
407415 & self , payment_hash : PaymentHash , payment_secret : Option < PaymentSecret > , payment_id : PaymentId ,
408416 route : & Route , keys_manager : & K , best_block_height : u32
409417 ) -> Result < Vec < [ u8 ; 32 ] > , PaymentSendFailure > where K :: Target : KeysInterface {
@@ -439,7 +447,8 @@ impl OutboundPayments {
439447 & self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > ,
440448 keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > ,
441449 onion_session_privs : Vec < [ u8 ; 32 ] > , keys_manager : & K , best_block_height : u32 ,
442- send_payment_along_path : F ) -> Result < ( ) , PaymentSendFailure >
450+ send_payment_along_path : F
451+ ) -> Result < ( ) , PaymentSendFailure >
443452 where
444453 K :: Target : KeysInterface ,
445454 F : Fn ( & Vec < RouteHop > , & Option < PaymentParameters > , & PaymentHash , & Option < PaymentSecret > , u64 ,
@@ -548,7 +557,8 @@ impl OutboundPayments {
548557 & self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > ,
549558 keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > ,
550559 onion_session_privs : Vec < [ u8 ; 32 ] > , keys_manager : & K , best_block_height : u32 ,
551- send_payment_along_path : F ) -> Result < ( ) , PaymentSendFailure >
560+ send_payment_along_path : F
561+ ) -> Result < ( ) , PaymentSendFailure >
552562 where
553563 K :: Target : KeysInterface ,
554564 F : Fn ( & Vec < RouteHop > , & Option < PaymentParameters > , & PaymentHash , & Option < PaymentSecret > , u64 ,
@@ -561,8 +571,8 @@ impl OutboundPayments {
561571
562572 pub ( super ) fn claim_htlc < L : Deref > (
563573 & self , payment_id : PaymentId , payment_preimage : PaymentPreimage , session_priv : SecretKey ,
564- path : Vec < RouteHop > , from_onchain : bool , pending_events : & Mutex < Vec < events:: Event > > , logger : & L )
565- where L :: Target : Logger {
574+ path : Vec < RouteHop > , from_onchain : bool , pending_events : & Mutex < Vec < events:: Event > > , logger : & L
575+ ) where L :: Target : Logger {
566576 let mut session_priv_bytes = [ 0 ; 32 ] ;
567577 session_priv_bytes. copy_from_slice ( & session_priv[ ..] ) ;
568578 let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
@@ -671,8 +681,8 @@ impl OutboundPayments {
671681 & self , source : & HTLCSource , payment_hash : & PaymentHash , onion_error : & HTLCFailReason ,
672682 path : & Vec < RouteHop > , session_priv : & SecretKey , payment_id : & PaymentId ,
673683 payment_params : & Option < PaymentParameters > , probing_cookie_secret : [ u8 ; 32 ] ,
674- secp_ctx : & Secp256k1 < secp256k1:: All > , pending_events : & Mutex < Vec < events:: Event > > , logger : & L )
675- where L :: Target : Logger {
684+ secp_ctx : & Secp256k1 < secp256k1:: All > , pending_events : & Mutex < Vec < events:: Event > > , logger : & L
685+ ) where L :: Target : Logger {
676686 let mut session_priv_bytes = [ 0 ; 32 ] ;
677687 session_priv_bytes. copy_from_slice ( & session_priv[ ..] ) ;
678688 let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
@@ -712,9 +722,9 @@ impl OutboundPayments {
712722 log_trace ! ( logger, "Failing outbound payment HTLC with payment_hash {}" , log_bytes!( payment_hash. 0 ) ) ;
713723
714724 let path_failure = {
715- #[ cfg( test) ]
725+ #[ cfg( test) ]
716726 let ( network_update, short_channel_id, payment_retryable, onion_error_code, onion_error_data) = onion_error. decode_onion_failure ( secp_ctx, logger, & source) ;
717- #[ cfg( not( test) ) ]
727+ #[ cfg( not( test) ) ]
718728 let ( network_update, short_channel_id, payment_retryable, _, _) = onion_error. decode_onion_failure ( secp_ctx, logger, & source) ;
719729
720730 if payment_is_probe ( payment_hash, & payment_id, probing_cookie_secret) {
0 commit comments