Skip to content

Commit de29d07

Browse files
committed
Include Refund context in blinded payment paths
When requesting a payment for a refund, include a context in the Bolt12Invoice's blinded payment paths indicated it is for such. When the eventual payment is received, the user can use the payment hash to correlate it with the corresponding Refund.
1 parent b806a04 commit de29d07

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ pub enum PaymentContext {
118118
/// [`Offer`]: crate::offers::offer::Offer
119119
offer_id: OfferId,
120120
},
121+
/// The payment was made for invoice sent for a BOLT 12 [`Refund`].
122+
///
123+
/// [`Refund`]: crate::offers::refund::Refund
124+
Bolt12Refund {},
121125
}
122126

123127
impl TryFrom<CounterpartyForwardingInfo> for PaymentRelay {
@@ -342,6 +346,7 @@ impl_writeable_tlv_based_enum!(PaymentContext,
342346
(1, Bolt12Offer) => {
343347
(0, offer_id, required),
344348
},
349+
(2, Bolt12Refund) => {},
345350
;
346351
);
347352

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8168,7 +8168,7 @@ where
81688168

81698169
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
81708170
Ok((payment_hash, payment_secret)) => {
8171-
let payment_context = PaymentContext::Bolt11Invoice {};
8171+
let payment_context = PaymentContext::Bolt12Refund {};
81728172
let payment_paths = self.create_blinded_payment_paths(
81738173
amount_msats, payment_secret, payment_context
81748174
)

0 commit comments

Comments
 (0)