@@ -403,7 +403,15 @@ impl OutboundPayments {
403
403
}
404
404
}
405
405
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 > (
407
415
& self , payment_hash : PaymentHash , payment_secret : Option < PaymentSecret > , payment_id : PaymentId ,
408
416
route : & Route , keys_manager : & K , best_block_height : u32
409
417
) -> Result < Vec < [ u8 ; 32 ] > , PaymentSendFailure > where K :: Target : KeysInterface {
@@ -439,7 +447,8 @@ impl OutboundPayments {
439
447
& self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > ,
440
448
keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > ,
441
449
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 >
443
452
where
444
453
K :: Target : KeysInterface ,
445
454
F : Fn ( & Vec < RouteHop > , & Option < PaymentParameters > , & PaymentHash , & Option < PaymentSecret > , u64 ,
@@ -548,7 +557,8 @@ impl OutboundPayments {
548
557
& self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > ,
549
558
keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > ,
550
559
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 >
552
562
where
553
563
K :: Target : KeysInterface ,
554
564
F : Fn ( & Vec < RouteHop > , & Option < PaymentParameters > , & PaymentHash , & Option < PaymentSecret > , u64 ,
@@ -561,8 +571,8 @@ impl OutboundPayments {
561
571
562
572
pub ( super ) fn claim_htlc < L : Deref > (
563
573
& 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 {
566
576
let mut session_priv_bytes = [ 0 ; 32 ] ;
567
577
session_priv_bytes. copy_from_slice ( & session_priv[ ..] ) ;
568
578
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
@@ -671,8 +681,8 @@ impl OutboundPayments {
671
681
& self , source : & HTLCSource , payment_hash : & PaymentHash , onion_error : & HTLCFailReason ,
672
682
path : & Vec < RouteHop > , session_priv : & SecretKey , payment_id : & PaymentId ,
673
683
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 {
676
686
let mut session_priv_bytes = [ 0 ; 32 ] ;
677
687
session_priv_bytes. copy_from_slice ( & session_priv[ ..] ) ;
678
688
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
@@ -712,9 +722,9 @@ impl OutboundPayments {
712
722
log_trace ! ( logger, "Failing outbound payment HTLC with payment_hash {}" , log_bytes!( payment_hash. 0 ) ) ;
713
723
714
724
let path_failure = {
715
- #[ cfg( test) ]
725
+ #[ cfg( test) ]
716
726
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) ) ]
718
728
let ( network_update, short_channel_id, payment_retryable, _, _) = onion_error. decode_onion_failure ( secp_ctx, logger, & source) ;
719
729
720
730
if payment_is_probe ( payment_hash, & payment_id, probing_cookie_secret) {
0 commit comments