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