Skip to content

Commit d62982a

Browse files
committed
Make ChannelManager::create_blinded_path context-type-generic
In the next commit we'll want to use `create_blinded_path` to build a blinded path with a `DNSResolverContext` rather than an `OffersContext`. In order to do so, it needs to take a generic `MessageContext` rather than an `OffersContext`, which we let it here.
1 parent 8c1ef52 commit d62982a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/ln/channelmanager.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9086,7 +9086,7 @@ where
90869086

90879087
let hmac = payment_id.hmac_for_offer_payment(nonce, expanded_key);
90889088
let context = OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) };
9089-
let reply_paths = self.create_blinded_paths(context)
9089+
let reply_paths = self.create_blinded_paths(MessageContext::Offers(context))
90909090
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
90919091

90929092
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
@@ -9193,7 +9193,7 @@ where
91939193
let context = OffersContext::InboundPayment {
91949194
payment_hash: invoice.payment_hash(),
91959195
};
9196-
let reply_paths = self.create_blinded_paths(context)
9196+
let reply_paths = self.create_blinded_paths(MessageContext::Offers(context))
91979197
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
91989198

91999199
let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
@@ -9340,7 +9340,7 @@ where
93409340
if absolute_expiry.unwrap_or(Duration::MAX) <= max_short_lived_absolute_expiry {
93419341
self.create_compact_blinded_paths(context)
93429342
} else {
9343-
self.create_blinded_paths(context)
9343+
self.create_blinded_paths(MessageContext::Offers(context))
93449344
}
93459345
}
93469346

@@ -9361,7 +9361,7 @@ where
93619361
/// [`MessageRouter::create_blinded_paths`].
93629362
///
93639363
/// Errors if the `MessageRouter` errors.
9364-
fn create_blinded_paths(&self, context: OffersContext) -> Result<Vec<BlindedMessagePath>, ()> {
9364+
fn create_blinded_paths(&self, context: MessageContext) -> Result<Vec<BlindedMessagePath>, ()> {
93659365
let recipient = self.get_our_node_id();
93669366
let secp_ctx = &self.secp_ctx;
93679367

@@ -9374,7 +9374,7 @@ where
93749374
.collect::<Vec<_>>();
93759375

93769376
self.router
9377-
.create_blinded_paths(recipient, MessageContext::Offers(context), peers, secp_ctx)
9377+
.create_blinded_paths(recipient, context, peers, secp_ctx)
93789378
.and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
93799379
}
93809380

0 commit comments

Comments
 (0)