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