@@ -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};
@@ -7073,6 +7074,9 @@ where
7073
7074
/// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
7074
7075
/// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer.
7075
7076
///
7077
+ /// Uses a one-hop [`BlindedPath`] for the offer with [`ChannelManager::get_our_node_id`] as the
7078
+ /// introduction node and a derived signing pubkey for recipient privacy.
7079
+ ///
7076
7080
/// [`Offer`]: crate::offers::offer::Offer
7077
7081
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
7078
7082
pub fn create_offer_builder(
@@ -7082,17 +7086,21 @@ where
7082
7086
let expanded_key = &self.inbound_payment_key;
7083
7087
let entropy = &*self.entropy_source;
7084
7088
let secp_ctx = &self.secp_ctx;
7089
+ let path = self.create_one_hop_blinded_path();
7085
7090
7086
- // TODO: Set blinded paths
7087
7091
OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
7088
7092
.chain_hash(self.chain_hash)
7093
+ .path(path)
7089
7094
}
7090
7095
7091
7096
/// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
7092
7097
/// [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund.
7093
7098
///
7094
7099
/// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
7095
7100
///
7101
+ /// Uses a one-hop [`BlindedPath`] for the refund with [`ChannelManager::get_our_node_id`] as
7102
+ /// the introduction node and a derived payer id for sender privacy.
7103
+ ///
7096
7104
/// [`Refund`]: crate::offers::refund::Refund
7097
7105
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
7098
7106
pub fn create_refund_builder(
@@ -7103,11 +7111,14 @@ where
7103
7111
let expanded_key = &self.inbound_payment_key;
7104
7112
let entropy = &*self.entropy_source;
7105
7113
let secp_ctx = &self.secp_ctx;
7114
+ let path = self.create_one_hop_blinded_path();
7106
7115
7107
- // TODO: Set blinded paths
7108
7116
let builder = RefundBuilder::deriving_payer_id(
7109
7117
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
7110
- )?.chain_hash(self.chain_hash);
7118
+ )?
7119
+ .chain_hash(self.chain_hash)
7120
+ .path(path);
7121
+
7111
7122
self.pending_outbound_payments
7112
7123
.add_new_awaiting_invoice(payment_id, retry_strategy, max_total_routing_fee_msat)
7113
7124
.map_err(|_| Bolt12SemanticError::DuplicatePaymentId)?;
@@ -7215,6 +7226,15 @@ where
7215
7226
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
7216
7227
}
7217
7228
7229
+ /// Creates a one-hop blinded path with [`ChannelManager::get_our_node_id`] as the introduction
7230
+ /// node.
7231
+ fn create_one_hop_blinded_path(&self) -> BlindedPath {
7232
+ let entropy_source = self.entropy_source.deref();
7233
+ let secp_ctx = &self.secp_ctx;
7234
+ BlindedPath::one_hop_for_message(self.get_our_node_id(), entropy_source, secp_ctx).unwrap()
7235
+
7236
+ }
7237
+
7218
7238
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
7219
7239
/// are used when constructing the phantom invoice's route hints.
7220
7240
///
0 commit comments