@@ -198,12 +198,12 @@ pub enum PendingHTLCRouting {
198
198
/// provide the onion shared secret used to decrypt the next level of forwarding
199
199
/// instructions.
200
200
phantom_shared_secret: Option<[u8; 32]>,
201
- /// Custom TLVs which were set by the sender.
201
+ /// Sender custom TLVs which were set by the sender.
202
202
///
203
203
/// For HTLCs received by LDK, this will ultimately be exposed in
204
204
/// [`Event::PaymentClaimable::onion_fields`] as
205
- /// [`RecipientOnionFields::custom_tlvs `].
206
- custom_tlvs : Vec<(u64, Vec<u8>)>,
205
+ /// [`RecipientOnionFields::sender_custom_tlvs `].
206
+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
207
207
/// Set if this HTLC is the final hop in a multi-hop blinded path.
208
208
requires_blinded_error: bool,
209
209
},
@@ -229,11 +229,11 @@ pub enum PendingHTLCRouting {
229
229
///
230
230
/// Used to track when we should expire pending HTLCs that go unclaimed.
231
231
incoming_cltv_expiry: u32,
232
- /// Custom TLVs which were set by the sender.
232
+ /// Sender custom TLVs which were set by the sender.
233
233
///
234
234
/// For HTLCs received by LDK, these will ultimately bubble back up as
235
- /// [`RecipientOnionFields::custom_tlvs `].
236
- custom_tlvs : Vec<(u64, Vec<u8>)>,
235
+ /// [`RecipientOnionFields::sender_custom_tlvs `].
236
+ sender_custom_tlvs : Vec<(u64, Vec<u8>)>,
237
237
/// Set if this HTLC is the final hop in a multi-hop blinded path.
238
238
requires_blinded_error: bool,
239
239
/// Set if we are receiving a keysend to a blinded path, meaning we created the
@@ -935,17 +935,17 @@ struct ClaimablePayments {
935
935
impl ClaimablePayments {
936
936
/// Moves a payment from [`Self::claimable_payments`] to [`Self::pending_claiming_payments`].
937
937
///
938
- /// If `custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
938
+ /// If `sender_custom_tlvs_known ` is false and custom even TLVs are set by the sender, the set of
939
939
/// pending HTLCs will be returned in the `Err` variant of this method. They MUST then be
940
940
/// failed by the caller as they will not be in either [`Self::claimable_payments`] or
941
941
/// [`Self::pending_claiming_payments`].
942
942
///
943
- /// If `custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
943
+ /// If `sender_custom_tlvs_known ` is true, and a matching payment is found, it will always be moved.
944
944
///
945
945
/// If no payment is found, `Err(Vec::new())` is returned.
946
946
fn begin_claiming_payment<L: Deref, S: Deref>(
947
947
&mut self, payment_hash: PaymentHash, node_signer: &S, logger: &L,
948
- inbound_payment_id_secret: &[u8; 32], custom_tlvs_known : bool,
948
+ inbound_payment_id_secret: &[u8; 32], sender_custom_tlvs_known : bool,
949
949
) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>>
950
950
where L::Target: Logger, S::Target: NodeSigner,
951
951
{
@@ -962,10 +962,10 @@ impl ClaimablePayments {
962
962
}
963
963
}
964
964
965
- if let Some(RecipientOnionFields { custom_tlvs , .. }) = &payment.onion_fields {
966
- if !custom_tlvs_known && custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
965
+ if let Some(RecipientOnionFields { sender_custom_tlvs , .. }) = &payment.onion_fields {
966
+ if !sender_custom_tlvs_known && sender_custom_tlvs .iter().any(|(typ, _)| typ % 2 == 0) {
967
967
log_info!(logger, "Rejecting payment with payment hash {} as we cannot accept payment with unknown even TLVs: {}",
968
- &payment_hash, log_iter!(custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
968
+ &payment_hash, log_iter!(sender_custom_tlvs .iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0)));
969
969
return Err(payment.htlcs);
970
970
}
971
971
}
@@ -6038,25 +6038,25 @@ where
6038
6038
) = match routing {
6039
6039
PendingHTLCRouting::Receive {
6040
6040
payment_data, payment_metadata, payment_context,
6041
- incoming_cltv_expiry, phantom_shared_secret, custom_tlvs ,
6041
+ incoming_cltv_expiry, phantom_shared_secret, sender_custom_tlvs ,
6042
6042
requires_blinded_error: _
6043
6043
} => {
6044
6044
let _legacy_hop_data = Some(payment_data.clone());
6045
6045
let onion_fields = RecipientOnionFields { payment_secret: Some(payment_data.payment_secret),
6046
- payment_metadata, custom_tlvs };
6046
+ payment_metadata, sender_custom_tlvs };
6047
6047
(incoming_cltv_expiry, OnionPayload::Invoice { _legacy_hop_data },
6048
6048
Some(payment_data), payment_context, phantom_shared_secret, onion_fields,
6049
6049
true)
6050
6050
},
6051
6051
PendingHTLCRouting::ReceiveKeysend {
6052
6052
payment_data, payment_preimage, payment_metadata,
6053
- incoming_cltv_expiry, custom_tlvs , requires_blinded_error: _,
6053
+ incoming_cltv_expiry, sender_custom_tlvs , requires_blinded_error: _,
6054
6054
has_recipient_created_payment_secret,
6055
6055
} => {
6056
6056
let onion_fields = RecipientOnionFields {
6057
6057
payment_secret: payment_data.as_ref().map(|data| data.payment_secret),
6058
6058
payment_metadata,
6059
- custom_tlvs ,
6059
+ sender_custom_tlvs ,
6060
6060
};
6061
6061
(incoming_cltv_expiry, OnionPayload::Spontaneous(payment_preimage),
6062
6062
payment_data, None, None, onion_fields, has_recipient_created_payment_secret)
@@ -6873,22 +6873,22 @@ where
6873
6873
/// event matches your expectation. If you fail to do so and call this method, you may provide
6874
6874
/// the sender "proof-of-payment" when they did not fulfill the full expected payment.
6875
6875
///
6876
- /// This function will fail the payment if it has custom TLVs with even type numbers, as we
6877
- /// will assume they are unknown. If you intend to accept even custom TLVs, you should use
6878
- /// [`claim_funds_with_known_custom_tlvs `].
6876
+ /// This function will fail the payment if it has sender custom TLVs with even type numbers, as we
6877
+ /// will assume they are unknown. If you intend to accept even sender custom TLVs, you should use
6878
+ /// [`claim_funds_with_known_sender_custom_tlvs `].
6879
6879
///
6880
6880
/// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
6881
6881
/// [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
6882
6882
/// [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
6883
6883
/// [`process_pending_events`]: EventsProvider::process_pending_events
6884
6884
/// [`create_inbound_payment`]: Self::create_inbound_payment
6885
6885
/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
6886
- /// [`claim_funds_with_known_custom_tlvs `]: Self::claim_funds_with_known_custom_tlvs
6886
+ /// [`claim_funds_with_known_sender_custom_tlvs `]: Self::claim_funds_with_known_sender_custom_tlvs
6887
6887
pub fn claim_funds(&self, payment_preimage: PaymentPreimage) {
6888
6888
self.claim_payment_internal(payment_preimage, false);
6889
6889
}
6890
6890
6891
- /// This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with
6891
+ /// This is a variant of [`claim_funds`] that allows accepting a payment with sender custom TLVs with
6892
6892
/// even type numbers.
6893
6893
///
6894
6894
/// # Note
@@ -6897,19 +6897,19 @@ where
6897
6897
/// claim, otherwise you may unintentionally agree to some protocol you do not understand.
6898
6898
///
6899
6899
/// [`claim_funds`]: Self::claim_funds
6900
- pub fn claim_funds_with_known_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
6900
+ pub fn claim_funds_with_known_sender_custom_tlvs (&self, payment_preimage: PaymentPreimage) {
6901
6901
self.claim_payment_internal(payment_preimage, true);
6902
6902
}
6903
6903
6904
- fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, custom_tlvs_known : bool) {
6904
+ fn claim_payment_internal(&self, payment_preimage: PaymentPreimage, sender_custom_tlvs_known : bool) {
6905
6905
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array());
6906
6906
6907
6907
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
6908
6908
6909
6909
let (sources, claiming_payment) = {
6910
6910
let res = self.claimable_payments.lock().unwrap().begin_claiming_payment(
6911
6911
payment_hash, &self.node_signer, &self.logger, &self.inbound_payment_id_secret,
6912
- custom_tlvs_known ,
6912
+ sender_custom_tlvs_known ,
6913
6913
);
6914
6914
6915
6915
match res {
@@ -12450,7 +12450,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12450
12450
(1, phantom_shared_secret, option),
12451
12451
(2, incoming_cltv_expiry, required),
12452
12452
(3, payment_metadata, option),
12453
- (5, custom_tlvs , optional_vec),
12453
+ (5, sender_custom_tlvs , optional_vec),
12454
12454
(7, requires_blinded_error, (default_value, false)),
12455
12455
(9, payment_context, option),
12456
12456
},
@@ -12460,7 +12460,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12460
12460
(2, incoming_cltv_expiry, required),
12461
12461
(3, payment_metadata, option),
12462
12462
(4, payment_data, option), // Added in 0.0.116
12463
- (5, custom_tlvs , optional_vec),
12463
+ (5, sender_custom_tlvs , optional_vec),
12464
12464
(7, has_recipient_created_payment_secret, (default_value, false)),
12465
12465
},
12466
12466
);
@@ -15469,7 +15469,7 @@ mod tests {
15469
15469
payment_data: Some(msgs::FinalOnionHopData {
15470
15470
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
15471
15471
}),
15472
- custom_tlvs : Vec::new(),
15472
+ sender_custom_tlvs : Vec::new(),
15473
15473
};
15474
15474
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15475
15475
// intended amount, we fail the payment.
@@ -15491,7 +15491,7 @@ mod tests {
15491
15491
payment_data: Some(msgs::FinalOnionHopData {
15492
15492
payment_secret: PaymentSecret([0; 32]), total_msat: sender_intended_amt_msat,
15493
15493
}),
15494
- custom_tlvs : Vec::new(),
15494
+ sender_custom_tlvs : Vec::new(),
15495
15495
};
15496
15496
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
15497
15497
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
@@ -15515,7 +15515,7 @@ mod tests {
15515
15515
payment_data: Some(msgs::FinalOnionHopData {
15516
15516
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
15517
15517
}),
15518
- custom_tlvs : Vec::new(),
15518
+ sender_custom_tlvs : Vec::new(),
15519
15519
}, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
15520
15520
15521
15521
// Should not return an error as this condition:
0 commit comments