@@ -189,12 +189,12 @@ pub enum PendingHTLCRouting {
189
189
/// provide the onion shared secret used to decrypt the next level of forwarding
190
190
/// instructions.
191
191
phantom_shared_secret: Option<[u8; 32]>,
192
- /// Custom TLVs which were set by the sender.
192
+ /// Sender custom TLVs which were set by the sender.
193
193
///
194
194
/// For HTLCs received by LDK, this will ultimately be exposed in
195
195
/// [`Event::PaymentClaimable::onion_fields`] as
196
- /// [`RecipientOnionFields::custom_tlvs `].
197
- custom_tlvs : Vec<(u64, Vec<u8>)>,
196
+ /// [`RecipientOnionFields::sender_custom_tlvs `].
197
+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
198
198
/// Set if this HTLC is the final hop in a multi-hop blinded path.
199
199
requires_blinded_error: bool,
200
200
},
@@ -220,11 +220,11 @@ pub enum PendingHTLCRouting {
220
220
///
221
221
/// Used to track when we should expire pending HTLCs that go unclaimed.
222
222
incoming_cltv_expiry: u32,
223
- /// Custom TLVs which were set by the sender.
223
+ /// Sender custom TLVs which were set by the sender.
224
224
///
225
225
/// For HTLCs received by LDK, these will ultimately bubble back up as
226
- /// [`RecipientOnionFields::custom_tlvs `].
227
- custom_tlvs : Vec<(u64, Vec<u8>)>,
226
+ /// [`RecipientOnionFields::sender_custom_tlvs `].
227
+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
228
228
/// Set if this HTLC is the final hop in a multi-hop blinded path.
229
229
requires_blinded_error: bool,
230
230
/// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -912,17 +912,17 @@ struct ClaimablePayments {
912
912
impl ClaimablePayments {
913
913
/// Moves a payment from [`Self::claimable_payments`] to [`Self::pending_claiming_payments`].
914
914
///
915
- /// If `custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
915
+ /// If `sender_custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
916
916
/// pending HTLCs will be returned in the `Err` variant of this method. They MUST then be
917
917
/// failed by the caller as they will not be in either [`Self::claimable_payments`] or
918
918
/// [`Self::pending_claiming_payments`].
919
919
///
920
- /// If `custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
920
+ /// If `sender_custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
921
921
///
922
922
/// If no payment is found, `Err(Vec::new())` is returned.
923
923
fn begin_claiming_payment<L: Deref, S: Deref>(
924
924
&mut self, payment_hash: PaymentHash, node_signer: &S, logger: &L,
925
- inbound_payment_id_secret: &[u8; 32], custom_tlvs_known : bool,
925
+ inbound_payment_id_secret: &[u8; 32], sender_custom_tlvs_known : bool,
926
926
) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>>
927
927
where L::Target: Logger, S::Target: NodeSigner,
928
928
{
@@ -939,10 +939,10 @@ impl ClaimablePayments {
939
939
}
940
940
}
941
941
942
- if let Some(RecipientOnionFields { custom_tlvs , .. }) = &payment.onion_fields {
943
- if !custom_tlvs_known && custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
942
+ if let Some(RecipientOnionFields { sender_custom_tlvs , .. }) = &payment.onion_fields {
943
+ if !sender_custom_tlvs_known && sender_custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
944
944
log_info!(logger, "Rejecting payment with payment hash {} as we cannot accept payment with unknown even TLVs: {}",
945
- &payment_hash, log_iter!(custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
945
+ &payment_hash, log_iter!(sender_custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
946
946
return Err(payment.htlcs);
947
947
}
948
948
}
@@ -6051,25 +6051,25 @@ where
6051
6051
) = match routing {
6052
6052
PendingHTLCRouting::Receive {
6053
6053
payment_data, payment_metadata, payment_context,
6054
- incoming_cltv_expiry, phantom_shared_secret, custom_tlvs ,
6054
+ incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs ,
6055
6055
requires_blinded_error: _
6056
6056
} => {
6057
6057
let _legacy_hop_data = Some(payment_data.clone());
6058
6058
let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6059
- payment_metadata, custom_tlvs };
6059
+ payment_metadata, sender_custom_tlvs };
6060
6060
(incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
6061
6061
Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
6062
6062
true)
6063
6063
},
6064
6064
PendingHTLCRouting::ReceiveKeysend {
6065
6065
payment_data, payment_preimage, payment_metadata,
6066
- incoming_cltv_expiry, custom_tlvs , requires_blinded_error: _,
6066
+ incoming_cltv_expiry, sender_custom_tlvs , requires_blinded_error: _,
6067
6067
has_recipient_created_payment_secret,
6068
6068
} => {
6069
6069
let onion_fields = RecipientOnionFields {
6070
6070
payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
6071
6071
payment_metadata,
6072
- custom_tlvs ,
6072
+ sender_custom_tlvs ,
6073
6073
};
6074
6074
(incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
6075
6075
payment_data, None, None, onion_fields, has_recipient_created_payment_secret)
@@ -6893,22 +6893,22 @@ where
6893
6893
/// event matches your expectation. If you fail to do so and call this method, you may provide
6894
6894
/// the sender "proof-of-payment" when they did not fulfill the full expected payment.
6895
6895
///
6896
- /// This function will fail the payment if it has custom TLVs with even type numbers, as we
6897
- /// will assume they are unknown. If you intend to accept even custom TLVs, you should use
6898
- /// [`claim_funds_with_known_custom_tlvs `].
6896
+ /// This function will fail the payment if it has sender custom TLVs with even type numbers, as we
6897
+ /// will assume they are unknown. If you intend to accept even sender custom TLVs, you should use
6898
+ /// [`claim_funds_with_known_sender_custom_tlvs `].
6899
6899
///
6900
6900
/// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
6901
6901
/// [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
6902
6902
/// [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
6903
6903
/// [`process_pending_events`]: EventsProvider::process_pending_events
6904
6904
/// [`create_inbound_payment`]: Self::create_inbound_payment
6905
6905
/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
6906
- /// [`claim_funds_with_known_custom_tlvs `]: Self::claim_funds_with_known_custom_tlvs
6906
+ /// [`claim_funds_with_known_sender_custom_tlvs `]: Self::claim_funds_with_known_sender_custom_tlvs
6907
6907
pub fn claim_funds(&self, payment_preimage: PaymentPreimage) {
6908
6908
self.claim_payment_internal(payment_preimage, false);
6909
6909
}
6910
6910
6911
- /// This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with
6911
+ /// This is a variant of [`claim_funds`] that allows accepting a payment with sender custom TLVs with
6912
6912
/// even type numbers.
6913
6913
///
6914
6914
/// # Note
@@ -6917,19 +6917,19 @@ where
6917
6917
/// claim, otherwise you may unintentionally agree to some protocol you do not understand.
6918
6918
///
6919
6919
/// [`claim_funds`]: Self::claim_funds
6920
- pub fn claim_funds_with_known_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
6920
+ pub fn claim_funds_with_known_sender_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
6921
6921
self.claim_payment_internal(payment_preimage, true);
6922
6922
}
6923
6923
6924
- fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, custom_tlvs_known : bool) {
6924
+ fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, sender_custom_tlvs_known : bool) {
6925
6925
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
6926
6926
6927
6927
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
6928
6928
6929
6929
let (sources, claiming_payment) = {
6930
6930
let res = self.claimable_payments.lock().unwrap().begin_claiming_payment(
6931
6931
payment_hash, &self.node_signer, &self.logger, &self.inbound_payment_id_secret,
6932
- custom_tlvs_known ,
6932
+ sender_custom_tlvs_known ,
6933
6933
);
6934
6934
6935
6935
match res {
@@ -12389,7 +12389,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12389
12389
(1, phantom_shared_secret, option),
12390
12390
(2, incoming_cltv_expiry, required),
12391
12391
(3, payment_metadata, option),
12392
- (5, custom_tlvs , optional_vec),
12392
+ (5, sender_custom_tlvs , optional_vec),
12393
12393
(7, requires_blinded_error, (default_value, false)),
12394
12394
(9, payment_context, option),
12395
12395
},
@@ -12399,7 +12399,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12399
12399
(2, incoming_cltv_expiry, required),
12400
12400
(3, payment_metadata, option),
12401
12401
(4, payment_data, option), // Added in 0.0.116
12402
- (5, custom_tlvs , optional_vec),
12402
+ (5, sender_custom_tlvs , optional_vec),
12403
12403
(7, has_recipient_created_payment_secret, (default_value, false)),
12404
12404
},
12405
12405
);
@@ -15365,7 +15365,7 @@ mod tests {
15365
15365
payment_data: Some(msgs::FinalOnionHopData {
15366
15366
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
15367
15367
}),
15368
- custom_tlvs : Vec::new(),
15368
+ sender_custom_tlvs : Vec::new(),
15369
15369
};
15370
15370
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15371
15371
// intended amount, we fail the payment.
@@ -15387,7 +15387,7 @@ mod tests {
15387
15387
payment_data: Some(msgs::FinalOnionHopData {
15388
15388
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
15389
15389
}),
15390
- custom_tlvs : Vec::new(),
15390
+ sender_custom_tlvs : Vec::new(),
15391
15391
};
15392
15392
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
15393
15393
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15411,7 +15411,7 @@ mod tests {
15411
15411
payment_data: Some(msgs::FinalOnionHopData {
15412
15412
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
15413
15413
}),
15414
- custom_tlvs : Vec::new(),
15414
+ sender_custom_tlvs : Vec::new(),
15415
15415
}, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
15416
15416
15417
15417
// Should not return an error as this condition:
0 commit comments