Skip to content

Commit 3137a10

Browse files
committed
f: Rename user_custom_tlvs -> user_custom_data
1 parent ce6b2dd commit 3137a10

File tree

8 files changed

+84
-84
lines changed

8 files changed

+84
-84
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ pub enum PendingHTLCRouting {
195195
/// [`Event::PaymentClaimable::onion_fields`] as
196196
/// [`RecipientOnionFields::sender_custom_tlvs`].
197197
sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
198-
/// Custom TLVs set by the receiver in the blinded path used to reach them.
198+
/// Custom data set by the receiver in the blinded path used to reach them.
199199
///
200200
/// For HTLCs received by LDK, this will be exposed in
201201
/// [`Event::PaymentClaimable::onion_fields`] as
202-
/// [`RecipientOnionFields::user_custom_tlvs`].
203-
user_custom_tlvs: Vec<u8>,
202+
/// [`RecipientOnionFields::user_custom_data`].
203+
user_custom_data: Vec<u8>,
204204
/// Set if this HTLC is the final hop in a multi-hop blinded path.
205205
requires_blinded_error: bool,
206206
},
@@ -231,11 +231,11 @@ pub enum PendingHTLCRouting {
231231
/// For HTLCs received by LDK, these will ultimately bubble back up as
232232
/// [`RecipientOnionFields::sender_custom_tlvs`].
233233
sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
234-
/// Custom TLVs set by the receiver in the blinded path used to reach them.
234+
/// Custom data set by the receiver in the blinded path used to reach them.
235235
///
236236
/// For HTLCs received by LDK, these will ultimately bubble back up as
237-
/// [`RecipientOnionFields::user_custom_tlvs`].
238-
user_custom_tlvs: Vec<u8>,
237+
/// [`RecipientOnionFields::user_custom_data`].
238+
user_custom_data: Vec<u8>,
239239
/// Set if this HTLC is the final hop in a multi-hop blinded path.
240240
requires_blinded_error: bool,
241241
/// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -6062,26 +6062,26 @@ where
60626062
) = match routing {
60636063
PendingHTLCRouting::Receive {
60646064
payment_data, payment_metadata, payment_context,
6065-
incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs, user_custom_tlvs,
6065+
incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs, user_custom_data,
60666066
requires_blinded_error: _
60676067
} => {
60686068
let _legacy_hop_data = Some(payment_data.clone());
60696069
let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6070-
payment_metadata, sender_custom_tlvs, user_custom_tlvs };
6070+
payment_metadata, sender_custom_tlvs, user_custom_data };
60716071
(incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
60726072
Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
60736073
true)
60746074
},
60756075
PendingHTLCRouting::ReceiveKeysend {
60766076
payment_data, payment_preimage, payment_metadata,
6077-
incoming_cltv_expiry, sender_custom_tlvs, user_custom_tlvs, requires_blinded_error: _,
6077+
incoming_cltv_expiry, sender_custom_tlvs, user_custom_data, requires_blinded_error: _,
60786078
has_recipient_created_payment_secret,
60796079
} => {
60806080
let onion_fields = RecipientOnionFields {
60816081
payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
60826082
payment_metadata,
60836083
sender_custom_tlvs,
6084-
user_custom_tlvs,
6084+
user_custom_data,
60856085
};
60866086
(incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
60876087
payment_data, None, None, onion_fields, has_recipient_created_payment_secret)
@@ -12400,7 +12400,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1240012400
(5, sender_custom_tlvs, optional_vec),
1240112401
(7, requires_blinded_error, (default_value, false)),
1240212402
(9, payment_context, option),
12403-
(11, user_custom_tlvs, optional_vec),
12403+
(11, user_custom_data, optional_vec),
1240412404
},
1240512405
(2, ReceiveKeysend) => {
1240612406
(0, payment_preimage, required),
@@ -12410,7 +12410,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1241012410
(4, payment_data, option), // Added in 0.0.116
1241112411
(5, sender_custom_tlvs, optional_vec),
1241212412
(7, has_recipient_created_payment_secret, (default_value, false)),
12413-
(9, user_custom_tlvs, optional_vec),
12413+
(9, user_custom_data, optional_vec),
1241412414
},
1241512415
);
1241612416

@@ -15376,7 +15376,7 @@ mod tests {
1537615376
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
1537715377
}),
1537815378
sender_custom_tlvs: Vec::new(),
15379-
user_custom_tlvs: Vec::new(),
15379+
user_custom_data: Vec::new(),
1538015380
};
1538115381
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
1538215382
// intended amount, we fail the payment.
@@ -15399,7 +15399,7 @@ mod tests {
1539915399
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
1540015400
}),
1540115401
sender_custom_tlvs: Vec::new(),
15402-
user_custom_tlvs: Vec::new(),
15402+
user_custom_data: Vec::new(),
1540315403
};
1540415404
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1540515405
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15424,7 +15424,7 @@ mod tests {
1542415424
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
1542515425
}),
1542615426
sender_custom_tlvs: Vec::new(),
15427-
user_custom_tlvs: Vec::new(),
15427+
user_custom_data: Vec::new(),
1542815428
}, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
1542915429

1543015430
// Should not return an error as this condition:

lightning/src/ln/functional_test_utils.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,7 @@ pub struct PassAlongPathArgs<'a, 'b, 'c, 'd> {
26342634
pub expected_preimage: Option<PaymentPreimage>,
26352635
pub is_probe: bool,
26362636
pub sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
2637-
pub user_custom_tlvs: Vec<u8>,
2637+
pub user_custom_data: Vec<u8>,
26382638
pub payment_metadata: Option<Vec<u8>>,
26392639
pub expected_failure: Option<HTLCDestination>,
26402640
}
@@ -2647,7 +2647,7 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
26472647
Self {
26482648
origin_node, expected_path, recv_value, payment_hash, payment_secret: None, event,
26492649
payment_claimable_expected: true, clear_recipient_events: true, expected_preimage: None,
2650-
is_probe: false, sender_custom_tlvs: Vec::new(), user_custom_tlvs: Vec::new(), payment_metadata: None, expected_failure: None,
2650+
is_probe: false, sender_custom_tlvs: Vec::new(), user_custom_data: Vec::new(), payment_metadata: None, expected_failure: None,
26512651
}
26522652
}
26532653
pub fn without_clearing_recipient_events(mut self) -> Self {
@@ -2675,8 +2675,8 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
26752675
self.sender_custom_tlvs = custom_tlvs;
26762676
self
26772677
}
2678-
pub fn with_user_custom_tlvs(mut self, custom_tlvs: Vec<u8>) -> Self {
2679-
self.user_custom_tlvs = custom_tlvs;
2678+
pub fn with_user_custom_data(mut self, custom_tlvs: Vec<u8>) -> Self {
2679+
self.user_custom_data = custom_tlvs;
26802680
self
26812681
}
26822682
pub fn with_payment_metadata(mut self, payment_metadata: Vec<u8>) -> Self {
@@ -2694,7 +2694,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event>
26942694
let PassAlongPathArgs {
26952695
origin_node, expected_path, recv_value, payment_hash: our_payment_hash,
26962696
payment_secret: our_payment_secret, event: ev, payment_claimable_expected,
2697-
clear_recipient_events, expected_preimage, is_probe, sender_custom_tlvs, user_custom_tlvs,
2697+
clear_recipient_events, expected_preimage, is_probe, sender_custom_tlvs, user_custom_data,
26982698
payment_metadata, expected_failure
26992699
} = args;
27002700

@@ -2729,7 +2729,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event>
27292729
assert_eq!(node.node.get_our_node_id(), receiver_node_id.unwrap());
27302730
assert!(onion_fields.is_some());
27312731
assert_eq!(onion_fields.as_ref().unwrap().sender_custom_tlvs, sender_custom_tlvs);
2732-
assert_eq!(onion_fields.as_ref().unwrap().user_custom_tlvs, user_custom_tlvs);
2732+
assert_eq!(onion_fields.as_ref().unwrap().user_custom_data, user_custom_data);
27332733
assert_eq!(onion_fields.as_ref().unwrap().payment_metadata, payment_metadata);
27342734
match &purpose {
27352735
PaymentPurpose::Bolt11InvoicePayment { payment_preimage, payment_secret, .. } => {
@@ -2849,7 +2849,7 @@ pub struct ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
28492849
pub skip_last: bool,
28502850
pub payment_preimage: PaymentPreimage,
28512851
pub sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
2852-
pub user_custom_tlvs: Vec<u8>,
2852+
pub user_custom_data: Vec<u8>,
28532853
// Allow forwarding nodes to have taken 1 msat more fee than expected based on the downstream
28542854
// fulfill amount.
28552855
//
@@ -2868,7 +2868,7 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
28682868
Self {
28692869
origin_node, expected_paths, expected_extra_fees: vec![0; expected_paths.len()],
28702870
expected_min_htlc_overpay: vec![0; expected_paths.len()], skip_last: false, payment_preimage,
2871-
allow_1_msat_fee_overpay: false, sender_custom_tlvs: vec![], user_custom_tlvs: vec![],
2871+
allow_1_msat_fee_overpay: false, sender_custom_tlvs: vec![], user_custom_data: vec![],
28722872
}
28732873
}
28742874
pub fn skip_last(mut self, skip_last: bool) -> Self {
@@ -2896,7 +2896,7 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
28962896
pub fn pass_claimed_payment_along_route(args: ClaimAlongRouteArgs) -> u64 {
28972897
let ClaimAlongRouteArgs {
28982898
origin_node, expected_paths, expected_extra_fees, expected_min_htlc_overpay, skip_last,
2899-
payment_preimage: our_payment_preimage, allow_1_msat_fee_overpay, sender_custom_tlvs, user_custom_tlvs,
2899+
payment_preimage: our_payment_preimage, allow_1_msat_fee_overpay, sender_custom_tlvs, user_custom_data,
29002900
} = args;
29012901
let claim_event = expected_paths[0].last().unwrap().node.get_and_clear_pending_events();
29022902
assert_eq!(claim_event.len(), 1);
@@ -2917,7 +2917,7 @@ pub fn pass_claimed_payment_along_route(args: ClaimAlongRouteArgs) -> u64 {
29172917
assert_eq!(htlcs.len(), expected_paths.len()); // One per path.
29182918
assert_eq!(htlcs.iter().map(|h| h.value_msat).sum::<u64>(), amount_msat);
29192919
assert_eq!(onion_fields.as_ref().unwrap().sender_custom_tlvs, sender_custom_tlvs);
2920-
assert_eq!(onion_fields.as_ref().unwrap().user_custom_tlvs, user_custom_tlvs);
2920+
assert_eq!(onion_fields.as_ref().unwrap().user_custom_data, user_custom_data);
29212921
check_claimed_htlcs_match_route(origin_node, expected_paths, htlcs);
29222922
fwd_amt_msat = amount_msat;
29232923
},
@@ -2935,7 +2935,7 @@ pub fn pass_claimed_payment_along_route(args: ClaimAlongRouteArgs) -> u64 {
29352935
assert_eq!(htlcs.len(), expected_paths.len()); // One per path.
29362936
assert_eq!(htlcs.iter().map(|h| h.value_msat).sum::<u64>(), amount_msat);
29372937
assert_eq!(onion_fields.as_ref().unwrap().sender_custom_tlvs, sender_custom_tlvs);
2938-
assert_eq!(onion_fields.as_ref().unwrap().user_custom_tlvs, user_custom_tlvs);
2938+
assert_eq!(onion_fields.as_ref().unwrap().user_custom_data, user_custom_data);
29392939
check_claimed_htlcs_match_route(origin_node, expected_paths, htlcs);
29402940
fwd_amt_msat = amount_msat;
29412941
}

lightning/src/ln/max_payment_path_len_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn large_payment_metadata() {
5959
payment_metadata: None,
6060
keysend_preimage: None,
6161
sender_custom_tlvs: &Vec::new(),
62-
user_custom_tlvs: &Vec::new(),
62+
user_custom_data: &Vec::new(),
6363
sender_intended_htlc_amt_msat: MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY,
6464
cltv_expiry_height: nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA,
6565
}.serialized_length();
@@ -77,7 +77,7 @@ fn large_payment_metadata() {
7777
payment_secret: Some(payment_secret),
7878
payment_metadata: Some(payment_metadata.clone()),
7979
sender_custom_tlvs: Vec::new(),
80-
user_custom_tlvs: Vec::new(),
80+
user_custom_data: Vec::new(),
8181
};
8282
nodes[0].node.send_payment(payment_hash, recipient_onion_max_md_size.clone(), PaymentId(payment_hash.0), route_0_1.route_params.clone().unwrap(), Retry::Attempts(0)).unwrap();
8383
check_added_monitors!(nodes[0], 1);
@@ -126,7 +126,7 @@ fn large_payment_metadata() {
126126
payment_secret: Some(payment_secret_2),
127127
payment_metadata: Some(vec![42; max_metadata_len - INTERMED_PAYLOAD_LEN_ESTIMATE]),
128128
sender_custom_tlvs: Vec::new(),
129-
user_custom_tlvs: Vec::new(),
129+
user_custom_data: Vec::new(),
130130
};
131131
let mut route_params_0_2 = route_0_2.route_params.clone().unwrap();
132132
route_params_0_2.payment_params.max_path_length = 2;
@@ -189,7 +189,7 @@ fn one_hop_blinded_path_with_custom_tlv() {
189189
keysend_preimage: None,
190190
invoice_request: None,
191191
sender_custom_tlvs: &Vec::new(),
192-
user_custom_tlvs: &Vec::new()
192+
user_custom_data: &Vec::new()
193193
}.serialized_length();
194194
let max_custom_tlv_len = 1300
195195
- crate::util::ser::BigSize(CUSTOM_TLV_TYPE).serialized_length() // custom TLV type

0 commit comments

Comments
 (0)