@@ -16,8 +16,8 @@ use chain::channelmonitor::ChannelMonitor;
1616use chain:: keysinterface:: { Recipient , KeysInterface } ;
1717use ln:: channelmanager:: { ChannelManager , ChannelManagerReadArgs , MIN_CLTV_EXPIRY_DELTA } ;
1818use routing:: network_graph:: RoutingFees ;
19- use routing:: router:: { RouteHint , RouteHintHop } ;
20- use ln:: features:: InitFeatures ;
19+ use routing:: router:: { PaymentParameters , RouteHint , RouteHintHop } ;
20+ use ln:: features:: { InitFeatures , InvoiceFeatures } ;
2121use ln:: msgs;
2222use ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler , OptionalField } ;
2323use util:: enforcing_trait_impls:: EnforcingSigner ;
@@ -71,7 +71,10 @@ fn test_priv_forwarding_rejection() {
7171 htlc_maximum_msat: None ,
7272 } ] ) ;
7373 let last_hops = vec ! [ route_hint] ;
74- let ( route, our_payment_hash, our_payment_preimage, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , last_hops, 10_000 , TEST_FINAL_CLTV ) ;
74+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) )
75+ . with_features ( InvoiceFeatures :: known ( ) )
76+ . with_route_hints ( last_hops) ;
77+ let ( route, our_payment_hash, our_payment_preimage, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, 10_000 , TEST_FINAL_CLTV ) ;
7578
7679 nodes[ 0 ] . node . send_payment ( & route, our_payment_hash, & Some ( our_payment_secret) ) . unwrap ( ) ;
7780 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -269,7 +272,10 @@ fn test_routed_scid_alias() {
269272 htlc_maximum_msat: None ,
270273 htlc_minimum_msat: None ,
271274 } ] ) ] ;
272- let ( route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , hop_hints, 100_000 , 42 ) ;
275+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) )
276+ . with_features ( InvoiceFeatures :: known ( ) )
277+ . with_route_hints ( hop_hints) ;
278+ let ( route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, 100_000 , 42 ) ;
273279 assert_eq ! ( route. paths[ 0 ] [ 1 ] . short_channel_id, last_hop[ 0 ] . inbound_scid_alias. unwrap( ) ) ;
274280 nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) ) . unwrap ( ) ;
275281 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -419,7 +425,10 @@ fn test_inbound_scid_privacy() {
419425 htlc_maximum_msat: None ,
420426 htlc_minimum_msat: None ,
421427 } ] ) ] ;
422- let ( route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , hop_hints. clone( ) , 100_000 , 42 ) ;
428+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) )
429+ . with_features ( InvoiceFeatures :: known ( ) )
430+ . with_route_hints ( hop_hints. clone ( ) ) ;
431+ let ( route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, 100_000 , 42 ) ;
423432 assert_eq ! ( route. paths[ 0 ] [ 1 ] . short_channel_id, last_hop[ 0 ] . inbound_scid_alias. unwrap( ) ) ;
424433 nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) ) . unwrap ( ) ;
425434 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -431,7 +440,10 @@ fn test_inbound_scid_privacy() {
431440 // what channel we're talking about.
432441 hop_hints[ 0 ] . 0 [ 0 ] . short_channel_id = last_hop[ 0 ] . short_channel_id . unwrap ( ) ;
433442
434- let ( route_2, payment_hash_2, _, payment_secret_2) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , hop_hints, 100_000 , 42 ) ;
443+ let payment_params_2 = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) )
444+ . with_features ( InvoiceFeatures :: known ( ) )
445+ . with_route_hints ( hop_hints) ;
446+ let ( route_2, payment_hash_2, _, payment_secret_2) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params_2, 100_000 , 42 ) ;
435447 assert_eq ! ( route_2. paths[ 0 ] [ 1 ] . short_channel_id, last_hop[ 0 ] . short_channel_id. unwrap( ) ) ;
436448 nodes[ 0 ] . node . send_payment ( & route_2, payment_hash_2, & Some ( payment_secret_2) ) . unwrap ( ) ;
437449 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -479,7 +491,10 @@ fn test_scid_alias_returned() {
479491 htlc_maximum_msat: None ,
480492 htlc_minimum_msat: None ,
481493 } ] ) ] ;
482- let ( mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , hop_hints, 10_000 , 42 ) ;
494+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) )
495+ . with_features ( InvoiceFeatures :: known ( ) )
496+ . with_route_hints ( hop_hints) ;
497+ let ( mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, 10_000 , 42 ) ;
483498 assert_eq ! ( route. paths[ 0 ] [ 1 ] . short_channel_id, nodes[ 2 ] . node. list_usable_channels( ) [ 0 ] . inbound_scid_alias. unwrap( ) ) ;
484499
485500 route. paths [ 0 ] [ 1 ] . fee_msat = 10_000_000 ; // Overshoot the last channel's value
0 commit comments