@@ -275,11 +275,6 @@ pub(crate) enum HTLCSource {
275275 first_hop_htlc_msat : u64 ,
276276 payment_id : PaymentId ,
277277 payment_secret : Option < PaymentSecret > ,
278- /// Note that this is now "deprecated" - we write it for forwards (and read it for
279- /// backwards) compatibility reasons, but prefer to use the data in the
280- /// [`super::outbound_payment`] module, which stores per-payment data once instead of in
281- /// each HTLC.
282- payment_params : Option < PaymentParameters > ,
283278 } ,
284279}
285280#[ allow( clippy:: derive_hash_xor_eq) ] // Our Hash is faithful to the data, we just don't have SecretKey::hash
@@ -290,14 +285,13 @@ impl core::hash::Hash for HTLCSource {
290285 0u8 . hash ( hasher) ;
291286 prev_hop_data. hash ( hasher) ;
292287 } ,
293- HTLCSource :: OutboundRoute { path, session_priv, payment_id, payment_secret, first_hop_htlc_msat, payment_params } => {
288+ HTLCSource :: OutboundRoute { path, session_priv, payment_id, payment_secret, first_hop_htlc_msat } => {
294289 1u8 . hash ( hasher) ;
295290 path. hash ( hasher) ;
296291 session_priv[ ..] . hash ( hasher) ;
297292 payment_id. hash ( hasher) ;
298293 payment_secret. hash ( hasher) ;
299294 first_hop_htlc_msat. hash ( hasher) ;
300- payment_params. hash ( hasher) ;
301295 } ,
302296 }
303297 }
@@ -312,7 +306,6 @@ impl HTLCSource {
312306 first_hop_htlc_msat : 0 ,
313307 payment_id : PaymentId ( [ 2 ; 32 ] ) ,
314308 payment_secret : None ,
315- payment_params : None ,
316309 }
317310 }
318311}
@@ -2467,12 +2460,12 @@ where
24672460 }
24682461
24692462 #[ cfg( test) ]
2470- pub ( crate ) fn test_send_payment_along_path ( & self , path : & Vec < RouteHop > , payment_params : & Option < PaymentParameters > , payment_hash : & PaymentHash , payment_secret : & Option < PaymentSecret > , total_value : u64 , cur_height : u32 , payment_id : PaymentId , keysend_preimage : & Option < PaymentPreimage > , session_priv_bytes : [ u8 ; 32 ] ) -> Result < ( ) , APIError > {
2463+ pub ( crate ) fn test_send_payment_along_path ( & self , path : & Vec < RouteHop > , payment_hash : & PaymentHash , payment_secret : & Option < PaymentSecret > , total_value : u64 , cur_height : u32 , payment_id : PaymentId , keysend_preimage : & Option < PaymentPreimage > , session_priv_bytes : [ u8 ; 32 ] ) -> Result < ( ) , APIError > {
24712464 let _lck = self . total_consistency_lock . read ( ) . unwrap ( ) ;
2472- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv_bytes)
2465+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv_bytes)
24732466 }
24742467
2475- fn send_payment_along_path ( & self , path : & Vec < RouteHop > , payment_params : & Option < PaymentParameters > , payment_hash : & PaymentHash , payment_secret : & Option < PaymentSecret > , total_value : u64 , cur_height : u32 , payment_id : PaymentId , keysend_preimage : & Option < PaymentPreimage > , session_priv_bytes : [ u8 ; 32 ] ) -> Result < ( ) , APIError > {
2468+ fn send_payment_along_path ( & self , path : & Vec < RouteHop > , payment_hash : & PaymentHash , payment_secret : & Option < PaymentSecret > , total_value : u64 , cur_height : u32 , payment_id : PaymentId , keysend_preimage : & Option < PaymentPreimage > , session_priv_bytes : [ u8 ; 32 ] ) -> Result < ( ) , APIError > {
24762469 // The top-level caller should hold the total_consistency_lock read lock.
24772470 debug_assert ! ( self . total_consistency_lock. try_write( ) . is_err( ) ) ;
24782471
@@ -2511,7 +2504,6 @@ where
25112504 first_hop_htlc_msat : htlc_msat,
25122505 payment_id,
25132506 payment_secret : payment_secret. clone ( ) ,
2514- payment_params : payment_params. clone ( ) ,
25152507 } , onion_packet, & self . logger ) ;
25162508 match break_chan_entry ! ( self , send_res, chan) {
25172509 Some ( monitor_update) => {
@@ -2617,8 +2609,8 @@ where
26172609 let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
26182610 self . pending_outbound_payments
26192611 . send_payment_with_route ( route, payment_hash, payment_secret, payment_id, & self . entropy_source , & self . node_signer , best_block_height,
2620- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2621- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2612+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2613+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
26222614 }
26232615
26242616 /// Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
@@ -2631,17 +2623,17 @@ where
26312623 & self . router , self . list_usable_channels ( ) , || self . compute_inflight_htlcs ( ) ,
26322624 & self . entropy_source , & self . node_signer , best_block_height, & self . logger ,
26332625 & self . pending_events ,
2634- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2635- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2626+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2627+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
26362628 }
26372629
26382630 #[ cfg( test) ]
26392631 fn test_send_payment_internal ( & self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > , keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > , onion_session_privs : Vec < [ u8 ; 32 ] > ) -> Result < ( ) , PaymentSendFailure > {
26402632 let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
26412633 let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
26422634 self . pending_outbound_payments . test_send_payment_internal ( route, payment_hash, payment_secret, keysend_preimage, payment_id, recv_value_msat, onion_session_privs, & self . node_signer , best_block_height,
2643- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2644- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2635+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2636+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
26452637 }
26462638
26472639 #[ cfg( test) ]
@@ -2693,8 +2685,8 @@ where
26932685 self . pending_outbound_payments . send_spontaneous_payment_with_route (
26942686 route, payment_preimage, payment_id, & self . entropy_source , & self . node_signer ,
26952687 best_block_height,
2696- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2697- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2688+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2689+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
26982690 }
26992691
27002692 /// Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
@@ -2711,8 +2703,8 @@ where
27112703 retry_strategy, route_params, & self . router , self . list_usable_channels ( ) ,
27122704 || self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
27132705 & self . logger , & self . pending_events ,
2714- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2715- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2706+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2707+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
27162708 }
27172709
27182710 /// Send a payment that is probing the given route for liquidity. We calculate the
@@ -2722,8 +2714,8 @@ where
27222714 let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
27232715 let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
27242716 self . pending_outbound_payments . send_probe ( hops, self . probing_cookie_secret , & self . entropy_source , & self . node_signer , best_block_height,
2725- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2726- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2717+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2718+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
27272719 }
27282720
27292721 /// Returns whether a payment with the given [`PaymentHash`] and [`PaymentId`] is, in fact, a
@@ -3447,8 +3439,8 @@ where
34473439 self . pending_outbound_payments . check_retry_payments ( & self . router , || self . list_usable_channels ( ) ,
34483440 || self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
34493441 & self . pending_events , & self . logger ,
3450- |path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
3451- self . send_payment_along_path ( path, payment_params , payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) ) ;
3442+ |path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
3443+ self . send_payment_along_path ( path, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) ) ;
34523444
34533445 for ( htlc_source, payment_hash, failure_reason, destination) in failed_forwards. drain ( ..) {
34543446 self . fail_htlc_backwards_internal ( & htlc_source, & payment_hash, & failure_reason, destination) ;
@@ -3834,9 +3826,9 @@ where
38343826 // from block_connected which may run during initialization prior to the chain_monitor
38353827 // being fully configured. See the docs for `ChannelManagerReadArgs` for more.
38363828 match source {
3837- HTLCSource :: OutboundRoute { ref path, ref session_priv, ref payment_id, ref payment_params , .. } => {
3829+ HTLCSource :: OutboundRoute { ref path, ref session_priv, ref payment_id, .. } => {
38383830 if self . pending_outbound_payments . fail_htlc ( source, payment_hash, onion_error, path,
3839- session_priv, payment_id, payment_params , self . probing_cookie_secret , & self . secp_ctx ,
3831+ session_priv, payment_id, self . probing_cookie_secret , & self . secp_ctx ,
38403832 & self . pending_events , & self . logger )
38413833 { self . push_pending_forwards_ev ( ) ; }
38423834 } ,
@@ -6858,7 +6850,6 @@ impl Readable for HTLCSource {
68586850 path,
68596851 payment_id : payment_id. unwrap ( ) ,
68606852 payment_secret,
6861- payment_params,
68626853 } )
68636854 }
68646855 1 => Ok ( HTLCSource :: PreviousHopData ( Readable :: read ( reader) ?) ) ,
@@ -6870,7 +6861,7 @@ impl Readable for HTLCSource {
68706861impl Writeable for HTLCSource {
68716862 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , crate :: io:: Error > {
68726863 match self {
6873- HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id, payment_secret, payment_params } => {
6864+ HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id, payment_secret } => {
68746865 0u8 . write ( writer) ?;
68756866 let payment_id_opt = Some ( payment_id) ;
68766867 write_tlv_fields ! ( writer, {
@@ -6879,7 +6870,7 @@ impl Writeable for HTLCSource {
68796870 ( 2 , first_hop_htlc_msat, required) ,
68806871 ( 3 , payment_secret, option) ,
68816872 ( 4 , * path, vec_type) ,
6882- ( 5 , payment_params , option) ,
6873+ ( 5 , None :: < PaymentParameters > , option) , // payment_params in LDK versions prior to 0.0.115
68836874 } ) ;
68846875 }
68856876 HTLCSource :: PreviousHopData ( ref field) => {
@@ -7959,7 +7950,7 @@ mod tests {
79597950 // indicates there are more HTLCs coming.
79607951 let cur_height = CHAN_CONFIRM_DEPTH + 1 ; // route_payment calls send_payment, which adds 1 to the current height. So we do the same here to match.
79617952 let session_privs = nodes[ 0 ] . node . test_add_new_pending_payment ( our_payment_hash, Some ( payment_secret) , payment_id, & mpp_route) . unwrap ( ) ;
7962- nodes[ 0 ] . node . test_send_payment_along_path ( & mpp_route. paths [ 0 ] , & route . payment_params , & our_payment_hash, & Some ( payment_secret) , 200_000 , cur_height, payment_id, & None , session_privs[ 0 ] ) . unwrap ( ) ;
7953+ nodes[ 0 ] . node . test_send_payment_along_path ( & mpp_route. paths [ 0 ] , & our_payment_hash, & Some ( payment_secret) , 200_000 , cur_height, payment_id, & None , session_privs[ 0 ] ) . unwrap ( ) ;
79637954 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
79647955 let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
79657956 assert_eq ! ( events. len( ) , 1 ) ;
@@ -7989,7 +7980,7 @@ mod tests {
79897980 expect_payment_failed ! ( nodes[ 0 ] , our_payment_hash, true ) ;
79907981
79917982 // Send the second half of the original MPP payment.
7992- nodes[ 0 ] . node . test_send_payment_along_path ( & mpp_route. paths [ 1 ] , & route . payment_params , & our_payment_hash, & Some ( payment_secret) , 200_000 , cur_height, payment_id, & None , session_privs[ 1 ] ) . unwrap ( ) ;
7983+ nodes[ 0 ] . node . test_send_payment_along_path ( & mpp_route. paths [ 1 ] , & our_payment_hash, & Some ( payment_secret) , 200_000 , cur_height, payment_id, & None , session_privs[ 1 ] ) . unwrap ( ) ;
79937984 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
79947985 let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
79957986 assert_eq ! ( events. len( ) , 1 ) ;
0 commit comments