@@ -216,12 +216,12 @@ pub enum PendingHTLCRouting {
216216 /// provide the onion shared secret used to decrypt the next level of forwarding
217217 /// instructions.
218218 phantom_shared_secret: Option<[u8; 32]>,
219- /// Custom TLVs which were set by the sender.
219+ /// Sender custom TLVs which were set by the sender.
220220 ///
221221 /// For HTLCs received by LDK, this will ultimately be exposed in
222222 /// [`Event::PaymentClaimable::onion_fields`] as
223- /// [`RecipientOnionFields::custom_tlvs `].
224- custom_tlvs : Vec<(u64, Vec<u8>)>,
223+ /// [`RecipientOnionFields::sender_custom_tlvs `].
224+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
225225 /// Set if this HTLC is the final hop in a multi-hop blinded path.
226226 requires_blinded_error: bool,
227227 },
@@ -247,11 +247,11 @@ pub enum PendingHTLCRouting {
247247 ///
248248 /// Used to track when we should expire pending HTLCs that go unclaimed.
249249 incoming_cltv_expiry: u32,
250- /// Custom TLVs which were set by the sender.
250+ /// Sender custom TLVs which were set by the sender.
251251 ///
252252 /// For HTLCs received by LDK, these will ultimately bubble back up as
253- /// [`RecipientOnionFields::custom_tlvs `].
254- custom_tlvs : Vec<(u64, Vec<u8>)>,
253+ /// [`RecipientOnionFields::sender_custom_tlvs `].
254+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
255255 /// Set if this HTLC is the final hop in a multi-hop blinded path.
256256 requires_blinded_error: bool,
257257 /// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -984,17 +984,17 @@ struct ClaimablePayments {
984984impl ClaimablePayments {
985985 /// Moves a payment from [`Self::claimable_payments`] to [`Self::pending_claiming_payments`].
986986 ///
987- /// If `custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
987+ /// If `sender_custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
988988 /// pending HTLCs will be returned in the `Err` variant of this method. They MUST then be
989989 /// failed by the caller as they will not be in either [`Self::claimable_payments`] or
990990 /// [`Self::pending_claiming_payments`].
991991 ///
992- /// If `custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
992+ /// If `sender_custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
993993 ///
994994 /// If no payment is found, `Err(Vec::new())` is returned.
995995 fn begin_claiming_payment<L: Deref, S: Deref>(
996996 &mut self, payment_hash: PaymentHash, node_signer: &S, logger: &L,
997- inbound_payment_id_secret: &[u8; 32], custom_tlvs_known : bool,
997+ inbound_payment_id_secret: &[u8; 32], sender_custom_tlvs_known : bool,
998998 ) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>>
999999 where L::Target: Logger, S::Target: NodeSigner,
10001000 {
@@ -1011,10 +1011,10 @@ impl ClaimablePayments {
10111011 }
10121012 }
10131013
1014- if let Some(RecipientOnionFields { custom_tlvs , .. }) = &payment.onion_fields {
1015- if !custom_tlvs_known && custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
1014+ if let Some(RecipientOnionFields { sender_custom_tlvs , .. }) = &payment.onion_fields {
1015+ if !sender_custom_tlvs_known && sender_custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
10161016 log_info!(logger, "Rejecting payment with payment hash {} as we cannot accept payment with unknown even TLVs: {}",
1017- &payment_hash, log_iter!(custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
1017+ &payment_hash, log_iter!(sender_custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
10181018 return Err(payment.htlcs);
10191019 }
10201020 }
@@ -6118,25 +6118,25 @@ where
61186118 ) = match routing {
61196119 PendingHTLCRouting::Receive {
61206120 payment_data, payment_metadata, payment_context,
6121- incoming_cltv_expiry, phantom_shared_secret, custom_tlvs ,
6121+ incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs ,
61226122 requires_blinded_error: _
61236123 } => {
61246124 let _legacy_hop_data = Some(payment_data.clone());
61256125 let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6126- payment_metadata, custom_tlvs };
6126+ payment_metadata, sender_custom_tlvs };
61276127 (incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
61286128 Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
61296129 true, None)
61306130 },
61316131 PendingHTLCRouting::ReceiveKeysend {
61326132 payment_data, payment_preimage, payment_metadata,
6133- incoming_cltv_expiry, custom_tlvs , requires_blinded_error: _,
6133+ incoming_cltv_expiry, sender_custom_tlvs , requires_blinded_error: _,
61346134 has_recipient_created_payment_secret, payment_context, invoice_request,
61356135 } => {
61366136 let onion_fields = RecipientOnionFields {
61376137 payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
61386138 payment_metadata,
6139- custom_tlvs ,
6139+ sender_custom_tlvs ,
61406140 };
61416141 (incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
61426142 payment_data, payment_context, None, onion_fields,
@@ -7001,22 +7001,22 @@ where
70017001 /// event matches your expectation. If you fail to do so and call this method, you may provide
70027002 /// the sender "proof-of-payment" when they did not fulfill the full expected payment.
70037003 ///
7004- /// This function will fail the payment if it has custom TLVs with even type numbers, as we
7005- /// will assume they are unknown. If you intend to accept even custom TLVs, you should use
7006- /// [`claim_funds_with_known_custom_tlvs `].
7004+ /// This function will fail the payment if it has sender custom TLVs with even type numbers, as we
7005+ /// will assume they are unknown. If you intend to accept even sender custom TLVs, you should use
7006+ /// [`claim_funds_with_known_sender_custom_tlvs `].
70077007 ///
70087008 /// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
70097009 /// [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
70107010 /// [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
70117011 /// [`process_pending_events`]: EventsProvider::process_pending_events
70127012 /// [`create_inbound_payment`]: Self::create_inbound_payment
70137013 /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
7014- /// [`claim_funds_with_known_custom_tlvs `]: Self::claim_funds_with_known_custom_tlvs
7014+ /// [`claim_funds_with_known_sender_custom_tlvs `]: Self::claim_funds_with_known_sender_custom_tlvs
70157015 pub fn claim_funds(&self, payment_preimage: PaymentPreimage) {
70167016 self.claim_payment_internal(payment_preimage, false);
70177017 }
70187018
7019- /// This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with
7019+ /// This is a variant of [`claim_funds`] that allows accepting a payment with sender custom TLVs with
70207020 /// even type numbers.
70217021 ///
70227022 /// # Note
@@ -7025,19 +7025,19 @@ where
70257025 /// claim, otherwise you may unintentionally agree to some protocol you do not understand.
70267026 ///
70277027 /// [`claim_funds`]: Self::claim_funds
7028- pub fn claim_funds_with_known_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
7028+ pub fn claim_funds_with_known_sender_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
70297029 self.claim_payment_internal(payment_preimage, true);
70307030 }
70317031
7032- fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, custom_tlvs_known : bool) {
7032+ fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, sender_custom_tlvs_known : bool) {
70337033 let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
70347034
70357035 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
70367036
70377037 let (sources, claiming_payment) = {
70387038 let res = self.claimable_payments.lock().unwrap().begin_claiming_payment(
70397039 payment_hash, &self.node_signer, &self.logger, &self.inbound_payment_id_secret,
7040- custom_tlvs_known ,
7040+ sender_custom_tlvs_known ,
70417041 );
70427042
70437043 match res {
@@ -12600,7 +12600,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1260012600 (1, phantom_shared_secret, option),
1260112601 (2, incoming_cltv_expiry, required),
1260212602 (3, payment_metadata, option),
12603- (5, custom_tlvs , optional_vec),
12603+ (5, sender_custom_tlvs , optional_vec),
1260412604 (7, requires_blinded_error, (default_value, false)),
1260512605 (9, payment_context, option),
1260612606 },
@@ -12610,7 +12610,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1261012610 (2, incoming_cltv_expiry, required),
1261112611 (3, payment_metadata, option),
1261212612 (4, payment_data, option), // Added in 0.0.116
12613- (5, custom_tlvs , optional_vec),
12613+ (5, sender_custom_tlvs , optional_vec),
1261412614 (7, has_recipient_created_payment_secret, (default_value, false)),
1261512615 (9, payment_context, option),
1261612616 (11, invoice_request, option),
@@ -12629,7 +12629,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1262912629 (1, phantom_shared_secret, option),
1263012630 (2, incoming_cltv_expiry, required),
1263112631 (3, payment_metadata, option),
12632- (5, custom_tlvs , optional_vec),
12632+ (5, sender_custom_tlvs , optional_vec),
1263312633 (7, requires_blinded_error, (default_value, false)),
1263412634 (9, payment_context, option),
1263512635 },
@@ -12639,7 +12639,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1263912639 (2, incoming_cltv_expiry, required),
1264012640 (3, payment_metadata, option),
1264112641 (4, payment_data, option), // Added in 0.0.116
12642- (5, custom_tlvs , optional_vec),
12642+ (5, sender_custom_tlvs , optional_vec),
1264312643 (7, has_recipient_created_payment_secret, (default_value, false)),
1264412644 (9, payment_context, option),
1264512645 (11, invoice_request, option),
@@ -15771,7 +15771,7 @@ mod tests {
1577115771 payment_secret: PaymentSecret([0; 32]),
1577215772 total_msat: sender_intended_amt_msat,
1577315773 }),
15774- custom_tlvs : Vec::new(),
15774+ sender_custom_tlvs : Vec::new(),
1577515775 });
1577615776 // Check that if the amount we received + the penultimate hop extra fee is less than the sender
1577715777 // intended amount, we fail the payment.
@@ -15794,7 +15794,7 @@ mod tests {
1579415794 payment_secret: PaymentSecret([0; 32]),
1579515795 total_msat: sender_intended_amt_msat,
1579615796 }),
15797- custom_tlvs : Vec::new(),
15797+ sender_custom_tlvs : Vec::new(),
1579815798 });
1579915799 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1580015800 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15819,7 +15819,7 @@ mod tests {
1581915819 payment_secret: PaymentSecret([0; 32]),
1582015820 total_msat: 100,
1582115821 }),
15822- custom_tlvs : Vec::new(),
15822+ sender_custom_tlvs : Vec::new(),
1582315823 }), [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
1582415824
1582515825 // Should not return an error as this condition:
0 commit comments