@@ -4885,9 +4885,7 @@ where
48854885 }
48864886 };
48874887
4888- if self.flow.enqueue_async_payment_messages(invoice, payment_id, |context| {
4889- self.create_blinded_paths(context)
4890- }).is_err() {
4888+ if self.flow.enqueue_async_payment_messages(invoice, payment_id, self.get_peers_for_blinded_path()).is_err() {
48914889 self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
48924890 res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
48934891 return NotifyOption::DoPersist
@@ -10102,9 +10100,7 @@ macro_rules! create_offer_builder { ($self: ident, $builder: ty) => {
1010210100 pub fn create_offer_builder(
1010310101 &$self, absolute_expiry: Option<Duration>
1010410102 ) -> Result<$builder, Bolt12SemanticError> {
10105- let builder = $self.flow.create_offer_builder(absolute_expiry, None, |context| {
10106- $self.create_blinded_paths_using_absolute_expiry(context, absolute_expiry)
10107- })?;
10103+ let builder = $self.flow.create_offer_builder(absolute_expiry, None, $self.get_peers_for_blinded_path())?;
1010810104
1010910105 Ok(builder.into())
1011010106 }
@@ -10160,9 +10156,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
1016010156 &$self, amount_msats: u64, absolute_expiry: Duration, payment_id: PaymentId,
1016110157 retry_strategy: Retry, route_params_config: RouteParametersConfig
1016210158 ) -> Result<$builder, Bolt12SemanticError> {
10163- let builder = $self.flow.create_refund_builder(amount_msats, absolute_expiry, payment_id, |context| {
10164- $self.create_blinded_paths_using_absolute_expiry(context, Some(absolute_expiry))
10165- })?;
10159+ let builder = $self.flow.create_refund_builder(amount_msats, absolute_expiry, payment_id, $self.get_peers_for_blinded_path())?;
1016610160
1016710161 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop($self);
1016810162
@@ -10226,7 +10220,7 @@ where
1022610220 let entropy = &*self.entropy_source;
1022710221 let nonce = Nonce::from_entropy_source(entropy);
1022810222
10229- let mut builder = self.flow.create_offer_builder(None, Some(nonce), |_| {Ok( Vec::new())} )?;
10223+ let mut builder = self.flow.create_offer_builder(None, Some(nonce), Vec::new())?;
1023010224 for path in message_paths_to_always_online_node {
1023110225 builder = builder.path(path);
1023210226 }
@@ -10241,13 +10235,7 @@ where
1024110235 pub fn create_static_invoice_builder<'a>(
1024210236 &'a self, offer: &'a Offer, offer_nonce: Nonce, relative_expiry: Option<Duration>
1024310237 ) -> Result<StaticInvoiceBuilder<'a>, Bolt12SemanticError> {
10244- self.flow.create_static_invoice_builder(offer, offer_nonce, relative_expiry, |amount_msats, payment_secret, payment_context, relative_expiry| {
10245- self.create_blinded_payment_paths(
10246- amount_msats, payment_secret, payment_context, relative_expiry
10247- )
10248- }, |context| {
10249- self.create_blinded_paths(context)
10250- })
10238+ self.flow.create_static_invoice_builder(offer, offer_nonce, relative_expiry, self.list_usable_channels(), self.get_peers_for_blinded_path())
1025110239 }
1025210240
1025310241 /// Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
@@ -10337,9 +10325,7 @@ where
1033710325 let invoice_request = builder.build_and_sign()?;
1033810326 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
1033910327
10340- self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, Some(nonce), |context| {
10341- self.create_blinded_paths(context)
10342- })?;
10328+ self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, Some(nonce), self.get_peers_for_blinded_path())?;
1034310329
1034410330 create_pending_payment(&invoice_request, nonce)
1034510331 }
@@ -10383,17 +10369,11 @@ where
1038310369 match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
1038410370 Ok((payment_hash, payment_secret)) => {
1038510371
10386- let builder = self.flow.create_invoice_builder_from_refund(refund, payment_hash, |payment_context| {
10387- self.create_blinded_payment_paths(
10388- Some(amount_msats), payment_secret, payment_context, relative_expiry
10389- )
10390- })?;
10372+ let builder = self.flow.create_invoice_builder_from_refund(refund, payment_hash, payment_secret, self.list_usable_channels())?;
1039110373
1039210374 let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?;
1039310375
10394- self.flow.enqueue_invoice(invoice.clone(), refund, payment_hash, |context| {
10395- self.create_blinded_paths(context)
10396- })?;
10376+ self.flow.enqueue_invoice(invoice.clone(), refund, payment_hash, self.get_peers_for_blinded_path())?;
1039710377
1039810378 Ok(invoice)
1039910379 },
@@ -10453,9 +10433,7 @@ where
1045310433 let expiration = StaleExpiration::TimerTicks(1);
1045410434 self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, route_params_config, amount_msats)?;
1045510435
10456- self.flow.enqueue_dns_onion_message(onion_message, context, dns_resolvers, |context| {
10457- self.create_blinded_paths(MessageContext::DNSResolver(context))
10458- }).map_err(|_| ())
10436+ self.flow.enqueue_dns_onion_message(onion_message, context, dns_resolvers, self.get_peers_for_blinded_path()).map_err(|_| ())
1045910437 }
1046010438
1046110439 /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
@@ -12132,19 +12110,7 @@ where
1213212110 {
1213312111 let RetryableInvoiceRequest { invoice_request, nonce, .. } = retryable_invoice_request;
1213412112
12135- if self.flow.enqueue_invoice_request(invoice_request, payment_id, Some(nonce), |context| {
12136- match self.create_blinded_paths(context) {
12137- Ok(paths) => Ok(paths),
12138- Err(err) => {
12139- log_warn!(self.logger,
12140- "Retry failed for an invoice request with payment_id: {}. \
12141- Reason: router could not find a blinded path to include as the reply path",
12142- payment_id
12143- );
12144- Err(err)
12145- }
12146- }
12147- }).is_err() {
12113+ if self.flow.enqueue_invoice_request(invoice_request, payment_id, Some(nonce), self.get_peers_for_blinded_path()).is_err() {
1214812114 log_warn!(
1214912115 self.logger,
1215012116 "Retry failed for invoice request with payment_id {}",
@@ -12239,9 +12205,7 @@ where
1223912205 },
1224012206 };
1224112207
12242- let response = self.flow.create_invoice_from_invoice_request(&self.node_signer, invoice_request, payment_hash, |payment_context| {
12243- self.create_blinded_payment_paths(Some(amount_msats), payment_secret, payment_context, relative_expiry)
12244- });
12208+ let response = self.flow.create_invoice_from_invoice_request(&self.node_signer, invoice_request, amount_msats, payment_hash, payment_secret, self.list_usable_channels());
1224512209
1224612210 match response {
1224712211 Ok(invoice) => {
0 commit comments