let invoice_request = builder.build_and_sign()?;
let hmac = payment_id.hmac_for_offer_payment(nonce, expanded_key);
- let context = OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) };
+ let context = MessageContext::Offers(
+ OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }
+ );
let reply_paths = self.create_blinded_paths(context)
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
let nonce = Nonce::from_entropy_source(entropy);
let hmac = payment_hash.hmac_for_offer_payment(nonce, expanded_key);
- let context = OffersContext::InboundPayment {
+ let context = MessageContext::Offers(OffersContext::InboundPayment {
payment_hash: invoice.payment_hash(), nonce, hmac
- };
+ });
let reply_paths = self.create_blinded_paths(context)
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
if absolute_expiry.unwrap_or(Duration::MAX) <= max_short_lived_absolute_expiry {
self.create_compact_blinded_paths(context)
} else {
- self.create_blinded_paths(context)
+ self.create_blinded_paths(MessageContext::Offers(context))
}
}
/// [`MessageRouter::create_blinded_paths`].
///
/// Errors if the `MessageRouter` errors.
- fn create_blinded_paths(&self, context: OffersContext) -> Result<Vec<BlindedMessagePath>, ()> {
+ fn create_blinded_paths(&self, context: MessageContext) -> Result<Vec<BlindedMessagePath>, ()> {
let recipient = self.get_our_node_id();
let secp_ctx = &self.secp_ctx;
.collect::<Vec<_>>();
self.router
- .create_blinded_paths(recipient, MessageContext::Offers(context), peers, secp_ctx)
+ .create_blinded_paths(recipient, context, peers, secp_ctx)
.and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
}
{
let RetryableInvoiceRequest { invoice_request, nonce } = retryable_invoice_request;
let hmac = payment_id.hmac_for_offer_payment(nonce, &self.inbound_payment_key);
- let context = OffersContext::OutboundPayment {
+ let context = MessageContext::Offers(OffersContext::OutboundPayment {
payment_id,
nonce,
hmac: Some(hmac)
- };
+ });
match self.create_blinded_paths(context) {
Ok(reply_paths) => match self.enqueue_invoice_request(invoice_request, reply_paths) {
Ok(_) => {}