You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PaymentContext is already stored in ClaimablePayment via PaymentPurpose,
so there is no need to repeat it in each ClaimableHTLC via OnionPayload.
This avoids cloning the PaymentContext each time an HTLC is received,
other than for the first HTLC for a payment.
let (payment_preimage, min_final_cltv_expiry_delta) = match inbound_payment::verify(payment_hash, &payment_data, self.highest_seen_timestamp.load(Ordering::Acquire) as u64, &self.inbound_payment_key, &self.logger) {
5536
5531
Ok(result) => result,
@@ -5550,7 +5545,7 @@ where
5550
5545
let purpose = events::PaymentPurpose::from_parts(
5551
5546
payment_preimage,
5552
5547
payment_data.payment_secret,
5553
-
payment_context.clone(),
5548
+
payment_context,
5554
5549
);
5555
5550
check_total_value!(purpose);
5556
5551
},
@@ -5561,13 +5556,10 @@ where
5561
5556
}
5562
5557
},
5563
5558
hash_map::Entry::Occupied(inbound_payment) => {
5564
-
let payment_context = match claimable_htlc.onion_payload {
5565
-
OnionPayload::Spontaneous(_) => {
5566
-
log_trace!(self.logger, "Failing new keysend HTLC with payment_hash {} because we already have an inbound payment with the same payment hash", &payment_hash);
if let OnionPayload::Spontaneous(_) = claimable_htlc.onion_payload {
5560
+
log_trace!(self.logger, "Failing new keysend HTLC with payment_hash {} because we already have an inbound payment with the same payment hash", &payment_hash);
5561
+
fail_htlc!(claimable_htlc, payment_hash);
5562
+
}
5571
5563
let payment_data = payment_data.unwrap();
5572
5564
if inbound_payment.get().payment_secret != payment_data.payment_secret {
5573
5565
log_trace!(self.logger, "Failing new HTLC with payment_hash {} as it didn't match our expected payment secret.", &payment_hash);
@@ -5580,7 +5572,7 @@ where
5580
5572
let purpose = events::PaymentPurpose::from_parts(
5581
5573
inbound_payment.get().payment_preimage,
5582
5574
payment_data.payment_secret,
5583
-
payment_context.clone(),
5575
+
payment_context,
5584
5576
);
5585
5577
let payment_claimable_generated = check_total_value!(purpose);
0 commit comments