@@ -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};
@@ -7089,6 +7090,11 @@ where
7089
7090
/// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will
7090
7091
/// not have an expiration unless otherwise set on the builder.
7091
7092
///
7093
+ /// Uses a one-hop [`BlindedPath`] for the offer with [`ChannelManager::get_our_node_id`] as the
7094
+ /// introduction node and a derived signing pubkey for recipient privacy. As such, currently,
7095
+ /// the node must be announced. Otherwise, there is no way to find a path to the introduction
7096
+ /// node in order to send the [`InvoiceRequest`].
7097
+ ///
7092
7098
/// [`Offer`]: crate::offers::offer::Offer
7093
7099
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
7094
7100
pub fn create_offer_builder(
@@ -7098,10 +7104,11 @@ where
7098
7104
let expanded_key = &self.inbound_payment_key;
7099
7105
let entropy = &*self.entropy_source;
7100
7106
let secp_ctx = &self.secp_ctx;
7107
+ let path = self.create_one_hop_blinded_path();
7101
7108
7102
- // TODO: Set blinded paths
7103
7109
OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
7104
7110
.chain_hash(self.chain_hash)
7111
+ .path(path)
7105
7112
}
7106
7113
7107
7114
/// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
@@ -7111,6 +7118,11 @@ where
7111
7118
///
7112
7119
/// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
7113
7120
///
7121
+ /// Uses a one-hop [`BlindedPath`] for the refund with [`ChannelManager::get_our_node_id`] as
7122
+ /// the introduction node and a derived payer id for sender privacy. As such, currently, the
7123
+ /// node must be announced. Otherwise, there is no way to find a path to the introduction node
7124
+ /// in order to send the [`Bolt12Invoice`].
7125
+ ///
7114
7126
/// [`Refund`]: crate::offers::refund::Refund
7115
7127
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
7116
7128
pub fn create_refund_builder(
@@ -7121,13 +7133,14 @@ where
7121
7133
let expanded_key = &self.inbound_payment_key;
7122
7134
let entropy = &*self.entropy_source;
7123
7135
let secp_ctx = &self.secp_ctx;
7136
+ let path = self.create_one_hop_blinded_path();
7124
7137
7125
- // TODO: Set blinded paths
7126
7138
let builder = RefundBuilder::deriving_payer_id(
7127
7139
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
7128
7140
)?
7129
7141
.chain_hash(self.chain_hash)
7130
- .absolute_expiry(absolute_expiry);
7142
+ .absolute_expiry(absolute_expiry)
7143
+ .path(path);
7131
7144
7132
7145
self.pending_outbound_payments
7133
7146
.add_new_awaiting_invoice(
@@ -7238,6 +7251,14 @@ where
7238
7251
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
7239
7252
}
7240
7253
7254
+ /// Creates a one-hop blinded path with [`ChannelManager::get_our_node_id`] as the introduction
7255
+ /// node.
7256
+ fn create_one_hop_blinded_path(&self) -> BlindedPath {
7257
+ let entropy_source = self.entropy_source.deref();
7258
+ let secp_ctx = &self.secp_ctx;
7259
+ BlindedPath::one_hop_for_message(self.get_our_node_id(), entropy_source, secp_ctx).unwrap()
7260
+ }
7261
+
7241
7262
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
7242
7263
/// are used when constructing the phantom invoice's route hints.
7243
7264
///
0 commit comments