Skip to content

Commit 4ea5dbf

Browse files
f total hops not just intermediate
1 parent b801053 commit 4ea5dbf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lightning/src/ln/max_payment_path_len_tests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn large_payment_metadata() {
8989
// next-hop peer given the payment_metadata size.
9090
let (mut route_0_2, payment_hash_2, payment_preimage_2, payment_secret_2) = get_route_and_payment_hash!(&nodes[0], &nodes[2], amt_msat);
9191
let mut route_params_0_2 = route_0_2.route_params.clone().unwrap();
92-
route_params_0_2.payment_params.max_intermediate_hops = 0;
92+
route_params_0_2.payment_params.max_path_length = 1;
9393
nodes[0].router.expect_find_route_query(route_params_0_2);
9494
let err = nodes[0].node.send_payment(payment_hash_2, recipient_onion_max_md_size.clone(), PaymentId(payment_hash_2.0), route_0_2.route_params.clone().unwrap(), Retry::Attempts(0)).unwrap_err();
9595
assert_eq!(err, RetryableSendFailure::RouteNotFound);
@@ -111,15 +111,15 @@ fn large_payment_metadata() {
111111
_ => panic!(),
112112
}
113113

114-
// If we remove enough payment_metadata bytes to allow for 1 intermediate hop, we're now able to
115-
// send to nodes[2].
114+
// If we remove enough payment_metadata bytes to allow for 2 hops, we're now able to send to
115+
// nodes[2].
116116
let mut recipient_onion_allws_2_hops = RecipientOnionFields {
117117
payment_secret: Some(payment_secret_2),
118118
payment_metadata: Some(vec![42; max_metadata_len - INTERMED_PAYLOAD_LEN_ESTIMATE]),
119119
custom_tlvs: Vec::new(),
120120
};
121121
let mut route_params_0_2 = route_0_2.route_params.clone().unwrap();
122-
route_params_0_2.payment_params.max_intermediate_hops = 1;
122+
route_params_0_2.payment_params.max_path_length = 2;
123123
nodes[0].router.expect_find_route_query(route_params_0_2);
124124
nodes[0].node.send_payment(payment_hash_2, recipient_onion_allws_2_hops.clone(), PaymentId(payment_hash_2.0), route_0_2.route_params.unwrap(), Retry::Attempts(0)).unwrap();
125125
check_added_monitors!(nodes[0], 1);
@@ -184,7 +184,7 @@ fn one_hop_blinded_path_with_custom_tlv() {
184184
- PAYLOAD_HMAC_LEN
185185
- final_payload_len_without_custom_tlv;
186186

187-
// Check that we can send the maximum custom TLV with 0 unblinded intermediate hops.
187+
// Check that we can send the maximum custom TLV with 1 blinded hop.
188188
let recipient_onion_max_custom_tlv_size = RecipientOnionFields::spontaneous_empty()
189189
.with_custom_tlvs(vec![(CUSTOM_TLV_TYPE, vec![42; max_custom_tlv_len])])
190190
.unwrap();
@@ -211,8 +211,8 @@ fn one_hop_blinded_path_with_custom_tlv() {
211211
let err = nodes[0].node.send_payment(payment_hash, recipient_onion_max_custom_tlv_size.clone(), PaymentId(payment_hash.0), route_params.clone(), Retry::Attempts(0)).unwrap_err();
212212
assert_eq!(err, RetryableSendFailure::RouteNotFound);
213213

214-
// If we remove enough custom TLV bytes to allow for 1 intermediate hop, we're now able to send
215-
// nodes[0] -> nodes[2].
214+
// If we remove enough custom TLV bytes to allow for 1 intermediate unblinded hop, we're now able
215+
// to send nodes[0] -> nodes[2].
216216
let mut recipient_onion_allows_2_hops = recipient_onion_max_custom_tlv_size.clone();
217217
recipient_onion_allows_2_hops.custom_tlvs[0].1.resize(max_custom_tlv_len - INTERMED_PAYLOAD_LEN_ESTIMATE, 0);
218218
nodes[0].node.send_payment(payment_hash, recipient_onion_allows_2_hops.clone(), PaymentId(payment_hash.0), route_params.clone(), Retry::Attempts(0)).unwrap();
@@ -302,8 +302,8 @@ fn blinded_path_with_custom_tlv() {
302302
let err = nodes[0].node.send_payment(payment_hash, recipient_onion_max_custom_tlv_size.clone(), PaymentId(payment_hash.0), route_params.clone(), Retry::Attempts(0)).unwrap_err();
303303
assert_eq!(err, RetryableSendFailure::RouteNotFound);
304304

305-
// If we remove enough custom TLV bytes to allow for 1 intermediate hop, we're now able to send
306-
// nodes[0] -> nodes[3].
305+
// If we remove enough custom TLV bytes to allow for 1 intermediate unblinded hop, we're now able
306+
// to send nodes[0] -> nodes[3].
307307
let mut recipient_onion_allows_2_hops = recipient_onion_max_custom_tlv_size.clone();
308308
recipient_onion_allows_2_hops.custom_tlvs[0].1.resize(max_custom_tlv_len - INTERMED_PAYLOAD_LEN_ESTIMATE, 0);
309309
nodes[0].node.send_payment(payment_hash, recipient_onion_allows_2_hops.clone(), PaymentId(payment_hash.0), route_params.clone(), Retry::Attempts(0)).unwrap();

0 commit comments

Comments
 (0)