@@ -216,12 +216,12 @@ pub enum PendingHTLCRouting {
216
216
/// provide the onion shared secret used to decrypt the next level of forwarding
217
217
/// instructions.
218
218
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.
220
220
///
221
221
/// For HTLCs received by LDK, this will ultimately be exposed in
222
222
/// [`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>)>,
225
225
/// Set if this HTLC is the final hop in a multi-hop blinded path.
226
226
requires_blinded_error: bool,
227
227
},
@@ -247,11 +247,11 @@ pub enum PendingHTLCRouting {
247
247
///
248
248
/// Used to track when we should expire pending HTLCs that go unclaimed.
249
249
incoming_cltv_expiry: u32,
250
- /// Custom TLVs which were set by the sender.
250
+ /// Sender custom TLVs which were set by the sender.
251
251
///
252
252
/// 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>)>,
255
255
/// Set if this HTLC is the final hop in a multi-hop blinded path.
256
256
requires_blinded_error: bool,
257
257
/// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -984,17 +984,17 @@ struct ClaimablePayments {
984
984
impl ClaimablePayments {
985
985
/// Moves a payment from [`Self::claimable_payments`] to [`Self::pending_claiming_payments`].
986
986
///
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
988
988
/// pending HTLCs will be returned in the `Err` variant of this method. They MUST then be
989
989
/// failed by the caller as they will not be in either [`Self::claimable_payments`] or
990
990
/// [`Self::pending_claiming_payments`].
991
991
///
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.
993
993
///
994
994
/// If no payment is found, `Err(Vec::new())` is returned.
995
995
fn begin_claiming_payment<L: Deref, S: Deref>(
996
996
&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,
998
998
) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>>
999
999
where L::Target: Logger, S::Target: NodeSigner,
1000
1000
{
@@ -1011,10 +1011,10 @@ impl ClaimablePayments {
1011
1011
}
1012
1012
}
1013
1013
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) {
1016
1016
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)));
1018
1018
return Err(payment.htlcs);
1019
1019
}
1020
1020
}
@@ -6118,25 +6118,25 @@ where
6118
6118
) = match routing {
6119
6119
PendingHTLCRouting::Receive {
6120
6120
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 ,
6122
6122
requires_blinded_error: _
6123
6123
} => {
6124
6124
let _legacy_hop_data = Some(payment_data.clone());
6125
6125
let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6126
- payment_metadata, custom_tlvs };
6126
+ payment_metadata, sender_custom_tlvs };
6127
6127
(incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
6128
6128
Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
6129
6129
true, None)
6130
6130
},
6131
6131
PendingHTLCRouting::ReceiveKeysend {
6132
6132
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: _,
6134
6134
has_recipient_created_payment_secret, payment_context, invoice_request,
6135
6135
} => {
6136
6136
let onion_fields = RecipientOnionFields {
6137
6137
payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
6138
6138
payment_metadata,
6139
- custom_tlvs ,
6139
+ sender_custom_tlvs ,
6140
6140
};
6141
6141
(incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
6142
6142
payment_data, payment_context, None, onion_fields,
@@ -7001,22 +7001,22 @@ where
7001
7001
/// event matches your expectation. If you fail to do so and call this method, you may provide
7002
7002
/// the sender "proof-of-payment" when they did not fulfill the full expected payment.
7003
7003
///
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 `].
7007
7007
///
7008
7008
/// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
7009
7009
/// [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
7010
7010
/// [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
7011
7011
/// [`process_pending_events`]: EventsProvider::process_pending_events
7012
7012
/// [`create_inbound_payment`]: Self::create_inbound_payment
7013
7013
/// [`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
7015
7015
pub fn claim_funds(&self, payment_preimage: PaymentPreimage) {
7016
7016
self.claim_payment_internal(payment_preimage, false);
7017
7017
}
7018
7018
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
7020
7020
/// even type numbers.
7021
7021
///
7022
7022
/// # Note
@@ -7025,19 +7025,19 @@ where
7025
7025
/// claim, otherwise you may unintentionally agree to some protocol you do not understand.
7026
7026
///
7027
7027
/// [`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) {
7029
7029
self.claim_payment_internal(payment_preimage, true);
7030
7030
}
7031
7031
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) {
7033
7033
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
7034
7034
7035
7035
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
7036
7036
7037
7037
let (sources, claiming_payment) = {
7038
7038
let res = self.claimable_payments.lock().unwrap().begin_claiming_payment(
7039
7039
payment_hash, &self.node_signer, &self.logger, &self.inbound_payment_id_secret,
7040
- custom_tlvs_known ,
7040
+ sender_custom_tlvs_known ,
7041
7041
);
7042
7042
7043
7043
match res {
@@ -12600,7 +12600,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12600
12600
(1, phantom_shared_secret, option),
12601
12601
(2, incoming_cltv_expiry, required),
12602
12602
(3, payment_metadata, option),
12603
- (5, custom_tlvs , optional_vec),
12603
+ (5, sender_custom_tlvs , optional_vec),
12604
12604
(7, requires_blinded_error, (default_value, false)),
12605
12605
(9, payment_context, option),
12606
12606
},
@@ -12610,7 +12610,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12610
12610
(2, incoming_cltv_expiry, required),
12611
12611
(3, payment_metadata, option),
12612
12612
(4, payment_data, option), // Added in 0.0.116
12613
- (5, custom_tlvs , optional_vec),
12613
+ (5, sender_custom_tlvs , optional_vec),
12614
12614
(7, has_recipient_created_payment_secret, (default_value, false)),
12615
12615
(9, payment_context, option),
12616
12616
(11, invoice_request, option),
@@ -12629,7 +12629,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12629
12629
(1, phantom_shared_secret, option),
12630
12630
(2, incoming_cltv_expiry, required),
12631
12631
(3, payment_metadata, option),
12632
- (5, custom_tlvs , optional_vec),
12632
+ (5, sender_custom_tlvs , optional_vec),
12633
12633
(7, requires_blinded_error, (default_value, false)),
12634
12634
(9, payment_context, option),
12635
12635
},
@@ -12639,7 +12639,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12639
12639
(2, incoming_cltv_expiry, required),
12640
12640
(3, payment_metadata, option),
12641
12641
(4, payment_data, option), // Added in 0.0.116
12642
- (5, custom_tlvs , optional_vec),
12642
+ (5, sender_custom_tlvs , optional_vec),
12643
12643
(7, has_recipient_created_payment_secret, (default_value, false)),
12644
12644
(9, payment_context, option),
12645
12645
(11, invoice_request, option),
@@ -15771,7 +15771,7 @@ mod tests {
15771
15771
payment_secret: PaymentSecret([0; 32]),
15772
15772
total_msat: sender_intended_amt_msat,
15773
15773
}),
15774
- custom_tlvs : Vec::new(),
15774
+ sender_custom_tlvs : Vec::new(),
15775
15775
});
15776
15776
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15777
15777
// intended amount, we fail the payment.
@@ -15794,7 +15794,7 @@ mod tests {
15794
15794
payment_secret: PaymentSecret([0; 32]),
15795
15795
total_msat: sender_intended_amt_msat,
15796
15796
}),
15797
- custom_tlvs : Vec::new(),
15797
+ sender_custom_tlvs : Vec::new(),
15798
15798
});
15799
15799
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
15800
15800
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15819,7 +15819,7 @@ mod tests {
15819
15819
payment_secret: PaymentSecret([0; 32]),
15820
15820
total_msat: 100,
15821
15821
}),
15822
- custom_tlvs : Vec::new(),
15822
+ sender_custom_tlvs : Vec::new(),
15823
15823
}), [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
15824
15824
15825
15825
// Should not return an error as this condition:
0 commit comments