@@ -28,8 +28,9 @@ use crate::util::config::UserConfig;
28
28
use crate :: util:: test_utils;
29
29
30
30
fn blinded_payment_path (
31
- payment_secret : PaymentSecret , node_ids : Vec < PublicKey > ,
32
- channel_upds : & [ & msgs:: UnsignedChannelUpdate ] , keys_manager : & test_utils:: TestKeysInterface
31
+ payment_secret : PaymentSecret , intro_node_min_htlc : u64 , intro_node_max_htlc : u64 ,
32
+ node_ids : Vec < PublicKey > , channel_upds : & [ & msgs:: UnsignedChannelUpdate ] ,
33
+ keys_manager : & test_utils:: TestKeysInterface
33
34
) -> ( BlindedPayInfo , BlindedPath ) {
34
35
let mut intermediate_nodes = Vec :: new ( ) ;
35
36
for ( node_id, chan_upd) in node_ids. iter ( ) . zip ( channel_upds) {
@@ -66,12 +67,16 @@ fn blinded_payment_path(
66
67
}
67
68
68
69
pub fn get_blinded_route_parameters (
69
- amt_msat : u64 , payment_secret : PaymentSecret , node_ids : Vec < PublicKey > ,
70
- channel_upds : & [ & msgs:: UnsignedChannelUpdate ] , keys_manager : & test_utils:: TestKeysInterface
70
+ amt_msat : u64 , payment_secret : PaymentSecret , intro_node_min_htlc : u64 , intro_node_max_htlc : u64 ,
71
+ node_ids : Vec < PublicKey > , channel_upds : & [ & msgs:: UnsignedChannelUpdate ] ,
72
+ keys_manager : & test_utils:: TestKeysInterface
71
73
) -> RouteParameters {
72
74
RouteParameters :: from_payment_params_and_value (
73
75
PaymentParameters :: blinded ( vec ! [
74
- blinded_payment_path( payment_secret, node_ids, channel_upds, keys_manager)
76
+ blinded_payment_path(
77
+ payment_secret, intro_node_min_htlc, intro_node_max_htlc, node_ids, channel_upds,
78
+ keys_manager
79
+ )
75
80
] ) , amt_msat
76
81
)
77
82
}
@@ -193,13 +198,13 @@ fn mpp_to_three_hop_blinded_paths() {
193
198
let ( payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 5 ] , Some ( amt_msat) , None ) ;
194
199
let route_params = {
195
200
let path_1_params = get_blinded_route_parameters (
196
- amt_msat, payment_secret, vec ! [
201
+ amt_msat, payment_secret, 1 , 1_0000_0000 , vec ! [
197
202
nodes[ 1 ] . node. get_our_node_id( ) , nodes[ 3 ] . node. get_our_node_id( ) ,
198
203
nodes[ 5 ] . node. get_our_node_id( )
199
204
] , & [ & chan_upd_1_3, & chan_upd_3_5] , & chanmon_cfgs[ 5 ] . keys_manager
200
205
) ;
201
206
let path_2_params = get_blinded_route_parameters (
202
- amt_msat, payment_secret, vec ! [
207
+ amt_msat, payment_secret, 1 , 1_0000_0000 , vec ! [
203
208
nodes[ 2 ] . node. get_our_node_id( ) , nodes[ 4 ] . node. get_our_node_id( ) ,
204
209
nodes[ 5 ] . node. get_our_node_id( )
205
210
] , & [ & chan_upd_2_4, & chan_upd_4_5] , & chanmon_cfgs[ 5 ] . keys_manager
@@ -268,7 +273,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
268
273
269
274
let amt_msat = 5000 ;
270
275
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 3 ] , Some ( amt_msat) , None ) ;
271
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
276
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
272
277
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) ,
273
278
& [ & chan_upd_1_2, & chan_upd_2_3] , & chanmon_cfgs[ 3 ] . keys_manager ) ;
274
279
@@ -368,7 +373,7 @@ fn failed_backwards_to_intro_node() {
368
373
369
374
let amt_msat = 5000 ;
370
375
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 2 ] , Some ( amt_msat) , None ) ;
371
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
376
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
372
377
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & chan_upd_1_2] ,
373
378
& chanmon_cfgs[ 2 ] . keys_manager ) ;
374
379
@@ -448,7 +453,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
448
453
449
454
let amt_msat = 5000 ;
450
455
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 2 ] , Some ( amt_msat) , None ) ;
451
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
456
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
452
457
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & chan_upd_1_2, & chan_upd_2_3] ,
453
458
& chanmon_cfgs[ 2 ] . keys_manager ) ;
454
459
@@ -565,7 +570,7 @@ fn do_blinded_intercept_payment(intercept_node_fails: bool) {
565
570
let intercept_scid = nodes[ 1 ] . node . get_intercept_scid ( ) ;
566
571
let mut intercept_chan_upd = chan_upd;
567
572
intercept_chan_upd. short_channel_id = intercept_scid;
568
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
573
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
569
574
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & intercept_chan_upd] ,
570
575
& chanmon_cfgs[ 2 ] . keys_manager ) ;
571
576
@@ -642,7 +647,7 @@ fn two_hop_blinded_path_success() {
642
647
643
648
let amt_msat = 5000 ;
644
649
let ( payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 2 ] , Some ( amt_msat) , None ) ;
645
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
650
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
646
651
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & chan_upd_1_2] ,
647
652
& chanmon_cfgs[ 2 ] . keys_manager ) ;
648
653
@@ -671,7 +676,7 @@ fn three_hop_blinded_path_success() {
671
676
672
677
let amt_msat = 5000 ;
673
678
let ( payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 4 ] , Some ( amt_msat) , None ) ;
674
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
679
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
675
680
nodes. iter ( ) . skip ( 2 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) ,
676
681
& [ & chan_upd_2_3, & chan_upd_3_4] , & chanmon_cfgs[ 4 ] . keys_manager ) ;
677
682
@@ -695,7 +700,7 @@ fn three_hop_blinded_path_fail() {
695
700
696
701
let amt_msat = 5000 ;
697
702
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 3 ] , Some ( amt_msat) , None ) ;
698
- let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
703
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
699
704
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) ,
700
705
& [ & chan_upd_1_2, & chan_upd_2_3] , & chanmon_cfgs[ 3 ] . keys_manager ) ;
701
706
@@ -786,7 +791,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
786
791
Some ( TEST_FINAL_CLTV as u16 - 2 )
787
792
} else { None } ;
788
793
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 2 ] , Some ( amt_msat) , excess_final_cltv_delta_opt) ;
789
- let mut route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
794
+ let mut route_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
790
795
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & chan_upd_1_2] ,
791
796
& chanmon_cfgs[ 2 ] . keys_manager ) ;
792
797
@@ -803,7 +808,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
803
808
let high_htlc_min_bp = {
804
809
let mut high_htlc_minimum_upd = chan_upd_1_2. clone ( ) ;
805
810
high_htlc_minimum_upd. htlc_minimum_msat = amt_msat + 1000 ;
806
- let high_htlc_min_params = get_blinded_route_parameters ( amt_msat, payment_secret,
811
+ let high_htlc_min_params = get_blinded_route_parameters ( amt_msat, payment_secret, 1 , 1_0000_0000 ,
807
812
nodes. iter ( ) . skip ( 1 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) , & [ & high_htlc_minimum_upd] ,
808
813
& chanmon_cfgs[ 2 ] . keys_manager ) ;
809
814
if let Payee :: Blinded { route_hints, .. } = high_htlc_min_params. payment_params . payee {
@@ -973,11 +978,11 @@ fn blinded_path_retries() {
973
978
let route_params = {
974
979
let pay_params = PaymentParameters :: blinded (
975
980
vec ! [
976
- blinded_payment_path( payment_secret,
981
+ blinded_payment_path( payment_secret, 1 , 1_0000_0000 ,
977
982
vec![ nodes[ 1 ] . node. get_our_node_id( ) , nodes[ 3 ] . node. get_our_node_id( ) ] , & [ & chan_1_3. 0 . contents] ,
978
983
& chanmon_cfgs[ 3 ] . keys_manager
979
984
) ,
980
- blinded_payment_path( payment_secret,
985
+ blinded_payment_path( payment_secret, 1 , 1_0000_0000 ,
981
986
vec![ nodes[ 2 ] . node. get_our_node_id( ) , nodes[ 3 ] . node. get_our_node_id( ) ] , & [ & chan_2_3. 0 . contents] ,
982
987
& chanmon_cfgs[ 3 ] . keys_manager
983
988
) ,
0 commit comments