Skip to content

Commit 18a3c5f

Browse files
committed
f: Rename user_custom_tlvs -> user_custom_data
1 parent fd4d33a commit 18a3c5f

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
@@ -196,12 +196,12 @@ pub enum PendingHTLCRouting {
196196
/// [`Event::PaymentClaimable::onion_fields`] as
197197
/// [`RecipientOnionFields::sender_custom_tlvs`].
198198
sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
199-
/// Custom TLVs set by the receiver in the blinded path used to reach them.
199+
/// Custom data set by the receiver in the blinded path used to reach them.
200200
///
201201
/// For HTLCs received by LDK, this will be exposed in
202202
/// [`Event::PaymentClaimable::onion_fields`] as
203-
/// [`RecipientOnionFields::user_custom_tlvs`].
204-
user_custom_tlvs: Vec<u8>,
203+
/// [`RecipientOnionFields::user_custom_data`].
204+
user_custom_data: Vec<u8>,
205205
/// Set if this HTLC is the final hop in a multi-hop blinded path.
206206
requires_blinded_error: bool,
207207
},
@@ -232,11 +232,11 @@ pub enum PendingHTLCRouting {
232232
/// For HTLCs received by LDK, these will ultimately bubble back up as
233233
/// [`RecipientOnionFields::sender_custom_tlvs`].
234234
sender_custom_tlvs: Vec<(u64, Vec<u8>)>,
235-
/// Custom TLVs set by the receiver in the blinded path used to reach them.
235+
/// Custom data set by the receiver in the blinded path used to reach them.
236236
///
237237
/// For HTLCs received by LDK, these will ultimately bubble back up as
238-
/// [`RecipientOnionFields::user_custom_tlvs`].
239-
user_custom_tlvs: Vec<u8>,
238+
/// [`RecipientOnionFields::user_custom_data`].
239+
user_custom_data: Vec<u8>,
240240
/// Set if this HTLC is the final hop in a multi-hop blinded path.
241241
requires_blinded_error: bool,
242242
/// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -5996,26 +5996,26 @@ where
59965996
) = match routing {
59975997
PendingHTLCRouting::Receive {
59985998
payment_data, payment_metadata, payment_context,
5999-
incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs, user_custom_tlvs,
5999+
incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs, user_custom_data,
60006000
requires_blinded_error: _
60016001
} => {
60026002
let _legacy_hop_data = Some(payment_data.clone());
60036003
let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6004-
payment_metadata, sender_custom_tlvs, user_custom_tlvs };
6004+
payment_metadata, sender_custom_tlvs, user_custom_data };
60056005
(incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
60066006
Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
60076007
true)
60086008
},
60096009
PendingHTLCRouting::ReceiveKeysend {
60106010
payment_data, payment_preimage, payment_metadata,
6011-
incoming_cltv_expiry, sender_custom_tlvs, user_custom_tlvs, requires_blinded_error: _,
6011+
incoming_cltv_expiry, sender_custom_tlvs, user_custom_data, requires_blinded_error: _,
60126012
has_recipient_created_payment_secret,
60136013
} => {
60146014
let onion_fields = RecipientOnionFields {
60156015
payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
60166016
payment_metadata,
60176017
sender_custom_tlvs,
6018-
user_custom_tlvs,
6018+
user_custom_data,
60196019
};
60206020
(incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
60216021
payment_data, None, None, onion_fields, has_recipient_created_payment_secret)
@@ -12363,7 +12363,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1236312363
(5, sender_custom_tlvs, optional_vec),
1236412364
(7, requires_blinded_error, (default_value, false)),
1236512365
(9, payment_context, option),
12366-
(11, user_custom_tlvs, optional_vec),
12366+
(11, user_custom_data, optional_vec),
1236712367
},
1236812368
(2, ReceiveKeysend) => {
1236912369
(0, payment_preimage, required),
@@ -12373,7 +12373,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1237312373
(4, payment_data, option), // Added in 0.0.116
1237412374
(5, sender_custom_tlvs, optional_vec),
1237512375
(7, has_recipient_created_payment_secret, (default_value, false)),
12376-
(9, user_custom_tlvs, optional_vec),
12376+
(9, user_custom_data, optional_vec),
1237712377
},
1237812378
);
1237912379

@@ -15369,7 +15369,7 @@ mod tests {
1536915369
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
1537015370
}),
1537115371
sender_custom_tlvs: Vec::new(),
15372-
user_custom_tlvs: Vec::new(),
15372+
user_custom_data: Vec::new(),
1537315373
};
1537415374
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
1537515375
// intended amount, we fail the payment.
@@ -15392,7 +15392,7 @@ mod tests {
1539215392
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
1539315393
}),
1539415394
sender_custom_tlvs: Vec::new(),
15395-
user_custom_tlvs: Vec::new(),
15395+
user_custom_data: Vec::new(),
1539615396
};
1539715397
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1539815398
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15417,7 +15417,7 @@ mod tests {
1541715417
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
1541815418
}),
1541915419
sender_custom_tlvs: Vec::new(),
15420-
user_custom_tlvs: Vec::new(),
15420+
user_custom_data: Vec::new(),
1542115421
}, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height,
1542215422
node[0].node.default_configuration.accept_mpp_keysend);
1542315423

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)