@@ -275,11 +275,6 @@ pub(crate) enum HTLCSource {
275
275
first_hop_htlc_msat : u64 ,
276
276
payment_id : PaymentId ,
277
277
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 > ,
283
278
} ,
284
279
}
285
280
#[ 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 {
290
285
0u8 . hash ( hasher) ;
291
286
prev_hop_data. hash ( hasher) ;
292
287
} ,
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 } => {
294
289
1u8 . hash ( hasher) ;
295
290
path. hash ( hasher) ;
296
291
session_priv[ ..] . hash ( hasher) ;
297
292
payment_id. hash ( hasher) ;
298
293
payment_secret. hash ( hasher) ;
299
294
first_hop_htlc_msat. hash ( hasher) ;
300
- payment_params. hash ( hasher) ;
301
295
} ,
302
296
}
303
297
}
@@ -312,7 +306,6 @@ impl HTLCSource {
312
306
first_hop_htlc_msat : 0 ,
313
307
payment_id : PaymentId ( [ 2 ; 32 ] ) ,
314
308
payment_secret : None ,
315
- payment_params : None ,
316
309
}
317
310
}
318
311
}
@@ -2467,12 +2460,12 @@ where
2467
2460
}
2468
2461
2469
2462
#[ 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 > {
2471
2464
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)
2473
2466
}
2474
2467
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 > {
2476
2469
// The top-level caller should hold the total_consistency_lock read lock.
2477
2470
debug_assert ! ( self . total_consistency_lock. try_write( ) . is_err( ) ) ;
2478
2471
@@ -2511,7 +2504,6 @@ where
2511
2504
first_hop_htlc_msat : htlc_msat,
2512
2505
payment_id,
2513
2506
payment_secret : payment_secret. clone ( ) ,
2514
- payment_params : payment_params. clone ( ) ,
2515
2507
} , onion_packet, & self . logger ) ;
2516
2508
match break_chan_entry ! ( self , send_res, chan) {
2517
2509
Some ( monitor_update) => {
@@ -2617,8 +2609,8 @@ where
2617
2609
let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
2618
2610
self . pending_outbound_payments
2619
2611
. 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) )
2622
2614
}
2623
2615
2624
2616
/// Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
@@ -2631,17 +2623,17 @@ where
2631
2623
& self . router , self . list_usable_channels ( ) , || self . compute_inflight_htlcs ( ) ,
2632
2624
& self . entropy_source , & self . node_signer , best_block_height, & self . logger ,
2633
2625
& 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) )
2636
2628
}
2637
2629
2638
2630
#[ cfg( test) ]
2639
2631
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 > {
2640
2632
let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
2641
2633
let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
2642
2634
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) )
2645
2637
}
2646
2638
2647
2639
#[ cfg( test) ]
@@ -2693,8 +2685,8 @@ where
2693
2685
self . pending_outbound_payments . send_spontaneous_payment_with_route (
2694
2686
route, payment_preimage, payment_id, & self . entropy_source , & self . node_signer ,
2695
2687
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) )
2698
2690
}
2699
2691
2700
2692
/// Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
@@ -2711,8 +2703,8 @@ where
2711
2703
retry_strategy, route_params, & self . router , self . list_usable_channels ( ) ,
2712
2704
|| self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
2713
2705
& 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) )
2716
2708
}
2717
2709
2718
2710
/// Send a payment that is probing the given route for liquidity. We calculate the
@@ -2722,8 +2714,8 @@ where
2722
2714
let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
2723
2715
let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
2724
2716
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) )
2727
2719
}
2728
2720
2729
2721
/// Returns whether a payment with the given [`PaymentHash`] and [`PaymentId`] is, in fact, a
@@ -3447,8 +3439,8 @@ where
3447
3439
self . pending_outbound_payments . check_retry_payments ( & self . router , || self . list_usable_channels ( ) ,
3448
3440
|| self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
3449
3441
& 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) ) ;
3452
3444
3453
3445
for ( htlc_source, payment_hash, failure_reason, destination) in failed_forwards. drain ( ..) {
3454
3446
self . fail_htlc_backwards_internal ( & htlc_source, & payment_hash, & failure_reason, destination) ;
@@ -3834,9 +3826,9 @@ where
3834
3826
// from block_connected which may run during initialization prior to the chain_monitor
3835
3827
// being fully configured. See the docs for `ChannelManagerReadArgs` for more.
3836
3828
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, .. } => {
3838
3830
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 ,
3840
3832
& self . pending_events , & self . logger )
3841
3833
{ self . push_pending_forwards_ev ( ) ; }
3842
3834
} ,
@@ -6858,7 +6850,6 @@ impl Readable for HTLCSource {
6858
6850
path,
6859
6851
payment_id : payment_id. unwrap ( ) ,
6860
6852
payment_secret,
6861
- payment_params,
6862
6853
} )
6863
6854
}
6864
6855
1 => Ok ( HTLCSource :: PreviousHopData ( Readable :: read ( reader) ?) ) ,
@@ -6870,7 +6861,7 @@ impl Readable for HTLCSource {
6870
6861
impl Writeable for HTLCSource {
6871
6862
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , crate :: io:: Error > {
6872
6863
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 } => {
6874
6865
0u8 . write ( writer) ?;
6875
6866
let payment_id_opt = Some ( payment_id) ;
6876
6867
write_tlv_fields ! ( writer, {
@@ -6879,7 +6870,7 @@ impl Writeable for HTLCSource {
6879
6870
( 2 , first_hop_htlc_msat, required) ,
6880
6871
( 3 , payment_secret, option) ,
6881
6872
( 4 , * path, vec_type) ,
6882
- ( 5 , payment_params , option) ,
6873
+ ( 5 , None :: < PaymentParameters > , option) , // payment_params in LDK versions prior to 0.0.115
6883
6874
} ) ;
6884
6875
}
6885
6876
HTLCSource :: PreviousHopData ( ref field) => {
@@ -7959,7 +7950,7 @@ mod tests {
7959
7950
// indicates there are more HTLCs coming.
7960
7951
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.
7961
7952
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 ( ) ;
7963
7954
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
7964
7955
let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
7965
7956
assert_eq ! ( events. len( ) , 1 ) ;
@@ -7989,7 +7980,7 @@ mod tests {
7989
7980
expect_payment_failed ! ( nodes[ 0 ] , our_payment_hash, true ) ;
7990
7981
7991
7982
// 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 ( ) ;
7993
7984
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
7994
7985
let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
7995
7986
assert_eq ! ( events. len( ) , 1 ) ;
0 commit comments