@@ -30,6 +30,7 @@ use bitcoin::secp256k1::{SecretKey,PublicKey};
30
30
use bitcoin::secp256k1::Secp256k1;
31
31
use bitcoin::{LockTime, secp256k1, Sequence};
32
32
33
+ use crate::blinded_path::BlindedPath;
33
34
use crate::chain;
34
35
use crate::chain::{Confirm, ChannelMonitorUpdateStatus, Watch, BestBlock};
35
36
use crate::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator, LowerBoundedFeeEstimator};
@@ -7130,6 +7131,11 @@ where
7130
7131
/// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will
7131
7132
/// not have an expiration unless otherwise set on the builder.
7132
7133
///
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
+ ///
7133
7139
/// [`Offer`]: crate::offers::offer::Offer
7134
7140
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
7135
7141
pub fn create_offer_builder(
@@ -7139,10 +7145,11 @@ where
7139
7145
let expanded_key = &self.inbound_payment_key;
7140
7146
let entropy = &*self.entropy_source;
7141
7147
let secp_ctx = &self.secp_ctx;
7148
+ let path = self.create_one_hop_blinded_path();
7142
7149
7143
- // TODO: Set blinded paths
7144
7150
OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
7145
7151
.chain_hash(self.chain_hash)
7152
+ .path(path)
7146
7153
}
7147
7154
7148
7155
/// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
@@ -7152,6 +7159,11 @@ where
7152
7159
///
7153
7160
/// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
7154
7161
///
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
+ ///
7155
7167
/// [`Refund`]: crate::offers::refund::Refund
7156
7168
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
7157
7169
pub fn create_refund_builder(
@@ -7162,13 +7174,14 @@ where
7162
7174
let expanded_key = &self.inbound_payment_key;
7163
7175
let entropy = &*self.entropy_source;
7164
7176
let secp_ctx = &self.secp_ctx;
7177
+ let path = self.create_one_hop_blinded_path();
7165
7178
7166
- // TODO: Set blinded paths
7167
7179
let builder = RefundBuilder::deriving_payer_id(
7168
7180
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
7169
7181
)?
7170
7182
.chain_hash(self.chain_hash)
7171
- .absolute_expiry(absolute_expiry);
7183
+ .absolute_expiry(absolute_expiry)
7184
+ .path(path);
7172
7185
7173
7186
self.pending_outbound_payments
7174
7187
.add_new_awaiting_invoice(
@@ -7279,6 +7292,14 @@ where
7279
7292
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
7280
7293
}
7281
7294
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
+
7282
7303
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
7283
7304
/// are used when constructing the phantom invoice's route hints.
7284
7305
///
0 commit comments