Skip to content

Commit 99494dd

Browse files
committed
f - create_invoice_request_builder
1 parent c4a87a7 commit 99494dd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ use crate::ln::outbound_payment;
5454
use crate::ln::outbound_payment::{OutboundPayments, PaymentAttempts, PendingOutboundPayment};
5555
use crate::ln::wire::Encode;
5656
use crate::chain::keysinterface::{EntropySource, KeysManager, NodeSigner, Recipient, SignerProvider, ChannelSigner, WriteableEcdsaChannelSigner};
57-
use crate::offers::offer::OfferBuilder;
57+
use crate::offers::invoice_request::InvoiceRequestBuilder;
58+
use crate::offers::offer::{Offer, OfferBuilder};
5859
use crate::offers::parse::SemanticError;
5960
use crate::offers::refund::RefundBuilder;
6061
use crate::util::config::{UserConfig, ChannelConfig};
@@ -5462,6 +5463,20 @@ where
54625463
RefundBuilder::deriving_payer_id(description, node_id, expanded_key, nonce, amount_msats)
54635464
}
54645465

5466+
/// Creates an [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is
5467+
/// recognized by the [`OnionMessenger`] when handling [`Invoice`] messages for the request.
5468+
///
5469+
/// [`OnionMessenger`]: crate::onion_message::OnionMessenger
5470+
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
5471+
/// [`Invoice`]: crate::offers::invoice::Invoice
5472+
pub fn create_invoice_request_builder<'a>(
5473+
&self, offer: &'a Offer
5474+
) -> Result<InvoiceRequestBuilder<'a>, SemanticError> {
5475+
let nonce = inbound_payment::Nonce::from_entropy_source(&*self.entropy_source);
5476+
5477+
offer.request_invoice_deriving_payer_id(&self.inbound_payment_key, nonce)
5478+
}
5479+
54655480
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
54665481
/// to pay us.
54675482
///

0 commit comments

Comments
 (0)