Skip to content

Commit 209c657

Browse files
committed
Include Offer context in blinded payment paths
When constructing blinded payment paths for a Bolt12Invoice response, include the OfferId so that the eventual payment can be correlated with the Offer.
1 parent 2e335e6 commit 209c657

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7979,7 +7979,9 @@ where
79797979

79807980
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
79817981
Ok((payment_hash, payment_secret)) => {
7982-
let payment_paths = self.create_blinded_payment_paths(amount_msats, payment_secret)
7982+
let payment_paths = self.create_blinded_payment_paths(
7983+
amount_msats, payment_secret, None
7984+
)
79837985
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
79847986

79857987
#[cfg(feature = "std")]
@@ -8145,7 +8147,8 @@ where
81458147
/// Creates multi-hop blinded payment paths for the given `amount_msats` by delegating to
81468148
/// [`Router::create_blinded_payment_paths`].
81478149
fn create_blinded_payment_paths(
8148-
&self, amount_msats: u64, payment_secret: PaymentSecret
8150+
&self, amount_msats: u64, payment_secret: PaymentSecret,
8151+
payment_context: Option<PaymentContext>
81498152
) -> Result<Vec<(BlindedPayInfo, BlindedPath)>, ()> {
81508153
let secp_ctx = &self.secp_ctx;
81518154

@@ -8159,7 +8162,7 @@ where
81598162
max_cltv_expiry,
81608163
htlc_minimum_msat: 1,
81618164
},
8162-
payment_context: None,
8165+
payment_context,
81638166
};
81648167
self.router.create_blinded_payment_paths(
81658168
payee_node_id, first_hops, payee_tlvs, amount_msats, secp_ctx
@@ -9493,8 +9496,11 @@ where
94939496
},
94949497
};
94959498

9499+
let payment_context = PaymentContext::Bolt12Offer {
9500+
offer_id: invoice_request.offer_id,
9501+
};
94969502
let payment_paths = match self.create_blinded_payment_paths(
9497-
amount_msats, payment_secret
9503+
amount_msats, payment_secret, Some(payment_context)
94989504
) {
94999505
Ok(payment_paths) => payment_paths,
95009506
Err(()) => {

0 commit comments

Comments
 (0)