@@ -4885,9 +4885,7 @@ where
4885
4885
}
4886
4886
};
4887
4887
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() {
4891
4889
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
4892
4890
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
4893
4891
return NotifyOption::DoPersist
@@ -10102,9 +10100,7 @@ macro_rules! create_offer_builder { ($self: ident, $builder: ty) => {
10102
10100
pub fn create_offer_builder(
10103
10101
&$self, absolute_expiry: Option<Duration>
10104
10102
) -> 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())?;
10108
10104
10109
10105
Ok(builder.into())
10110
10106
}
@@ -10160,9 +10156,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
10160
10156
&$self, amount_msats: u64, absolute_expiry: Duration, payment_id: PaymentId,
10161
10157
retry_strategy: Retry, route_params_config: RouteParametersConfig
10162
10158
) -> 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())?;
10166
10160
10167
10161
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop($self);
10168
10162
@@ -10226,7 +10220,7 @@ where
10226
10220
let entropy = &*self.entropy_source;
10227
10221
let nonce = Nonce::from_entropy_source(entropy);
10228
10222
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())?;
10230
10224
for path in message_paths_to_always_online_node {
10231
10225
builder = builder.path(path);
10232
10226
}
@@ -10241,13 +10235,7 @@ where
10241
10235
pub fn create_static_invoice_builder<'a>(
10242
10236
&'a self, offer: &'a Offer, offer_nonce: Nonce, relative_expiry: Option<Duration>
10243
10237
) -> 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())
10251
10239
}
10252
10240
10253
10241
/// Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
@@ -10337,9 +10325,7 @@ where
10337
10325
let invoice_request = builder.build_and_sign()?;
10338
10326
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
10339
10327
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())?;
10343
10329
10344
10330
create_pending_payment(&invoice_request, nonce)
10345
10331
}
@@ -10383,17 +10369,11 @@ where
10383
10369
match self.create_inbound_payment(Some(amount_msats), relative_expiry, None) {
10384
10370
Ok((payment_hash, payment_secret)) => {
10385
10371
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())?;
10391
10373
10392
10374
let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?;
10393
10375
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())?;
10397
10377
10398
10378
Ok(invoice)
10399
10379
},
@@ -10453,9 +10433,7 @@ where
10453
10433
let expiration = StaleExpiration::TimerTicks(1);
10454
10434
self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, route_params_config, amount_msats)?;
10455
10435
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(|_| ())
10459
10437
}
10460
10438
10461
10439
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
@@ -12132,19 +12110,7 @@ where
12132
12110
{
12133
12111
let RetryableInvoiceRequest { invoice_request, nonce, .. } = retryable_invoice_request;
12134
12112
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() {
12148
12114
log_warn!(
12149
12115
self.logger,
12150
12116
"Retry failed for invoice request with payment_id {}",
@@ -12239,9 +12205,7 @@ where
12239
12205
},
12240
12206
};
12241
12207
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());
12245
12209
12246
12210
match response {
12247
12211
Ok(invoice) => {
0 commit comments