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
When constructing a PaymentPurpose in ChannelManager, use the
PaymentContext from OnionPayload to determine which variant to
construct, including those for BOLT 12 payments.
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
5536
Ok(result) => result,
@@ -5547,10 +5547,11 @@ where
5547
5547
fail_htlc!(claimable_htlc, payment_hash);
5548
5548
}
5549
5549
}
5550
-
let purpose = events::PaymentPurpose::Bolt11InvoicePayment {
5551
-
payment_preimage: payment_preimage.clone(),
5552
-
payment_secret: payment_data.payment_secret,
5553
-
};
5550
+
let purpose = events::PaymentPurpose::from_parts(
5551
+
payment_preimage.clone(),
5552
+
payment_data.payment_secret,
5553
+
payment_context.clone(),
5554
+
);
5554
5555
check_total_value!(purpose);
5555
5556
},
5556
5557
OnionPayload::Spontaneous(preimage) => {
@@ -5560,10 +5561,13 @@ where
5560
5561
}
5561
5562
},
5562
5563
hash_map::Entry::Occupied(inbound_payment) => {
5563
-
if let OnionPayload::Spontaneous(_) = claimable_htlc.onion_payload {
5564
-
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);
5565
-
fail_htlc!(claimable_htlc, payment_hash);
5566
-
}
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);
0 commit comments