@@ -30,6 +30,7 @@ use bitcoin::secp256k1::{SecretKey,PublicKey};
3030use bitcoin::secp256k1::Secp256k1;
3131use bitcoin::{LockTime, secp256k1, Sequence};
3232
33+ use crate::blinded_path::BlindedPath;
3334use crate::chain;
3435use crate::chain::{Confirm, ChannelMonitorUpdateStatus, Watch, BestBlock};
3536use crate::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator, LowerBoundedFeeEstimator};
@@ -7130,6 +7131,11 @@ where
71307131 /// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will
71317132 /// not have an expiration unless otherwise set on the builder.
71327133 ///
7134+ /// Uses a one-hop [`BlindedPath`] for the offer with [`ChannelManager::get_our_node_id`] as the
7135+ /// introduction node and a derived signing pubkey for recipient privacy. As such, currently,
7136+ /// the node must be announced. Otherwise, there is no way to find a path to the introduction
7137+ /// node in order to send the [`InvoiceRequest`].
7138+ ///
71337139 /// [`Offer`]: crate::offers::offer::Offer
71347140 /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
71357141 pub fn create_offer_builder(
@@ -7139,10 +7145,11 @@ where
71397145 let expanded_key = &self.inbound_payment_key;
71407146 let entropy = &*self.entropy_source;
71417147 let secp_ctx = &self.secp_ctx;
7148+ let path = self.create_one_hop_blinded_path();
71427149
7143- // TODO: Set blinded paths
71447150 OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
71457151 .chain_hash(self.chain_hash)
7152+ .path(path)
71467153 }
71477154
71487155 /// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
@@ -7152,6 +7159,11 @@ where
71527159 ///
71537160 /// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
71547161 ///
7162+ /// Uses a one-hop [`BlindedPath`] for the refund with [`ChannelManager::get_our_node_id`] as
7163+ /// the introduction node and a derived payer id for sender privacy. As such, currently, the
7164+ /// node must be announced. Otherwise, there is no way to find a path to the introduction node
7165+ /// in order to send the [`Bolt12Invoice`].
7166+ ///
71557167 /// [`Refund`]: crate::offers::refund::Refund
71567168 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
71577169 pub fn create_refund_builder(
@@ -7162,13 +7174,14 @@ where
71627174 let expanded_key = &self.inbound_payment_key;
71637175 let entropy = &*self.entropy_source;
71647176 let secp_ctx = &self.secp_ctx;
7177+ let path = self.create_one_hop_blinded_path();
71657178
7166- // TODO: Set blinded paths
71677179 let builder = RefundBuilder::deriving_payer_id(
71687180 description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
71697181 )?
71707182 .chain_hash(self.chain_hash)
7171- .absolute_expiry(absolute_expiry);
7183+ .absolute_expiry(absolute_expiry)
7184+ .path(path);
71727185
71737186 self.pending_outbound_payments
71747187 .add_new_awaiting_invoice(
@@ -7279,6 +7292,14 @@ where
72797292 inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
72807293 }
72817294
7295+ /// Creates a one-hop blinded path with [`ChannelManager::get_our_node_id`] as the introduction
7296+ /// node.
7297+ fn create_one_hop_blinded_path(&self) -> BlindedPath {
7298+ let entropy_source = self.entropy_source.deref();
7299+ let secp_ctx = &self.secp_ctx;
7300+ BlindedPath::one_hop_for_message(self.get_our_node_id(), entropy_source, secp_ctx).unwrap()
7301+ }
7302+
72827303 /// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
72837304 /// are used when constructing the phantom invoice's route hints.
72847305 ///
0 commit comments