@@ -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};
@@ -6824,6 +6825,9 @@ where
6824
6825
/// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
6825
6826
/// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer.
6826
6827
///
6828
+ /// Uses a one-hop [`BlindedPath`] for the offer with [`ChannelManager::get_our_node_id`] as the
6829
+ /// introduction node and a derived signing pubkey for recipient privacy.
6830
+ ///
6827
6831
/// [`Offer`]: crate::offers::offer::Offer
6828
6832
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
6829
6833
pub fn create_offer_builder(
@@ -6833,16 +6837,20 @@ where
6833
6837
let expanded_key = &self.inbound_payment_key;
6834
6838
let entropy = &*self.entropy_source;
6835
6839
let secp_ctx = &self.secp_ctx;
6840
+ let path = self.create_one_hop_blinded_path();
6836
6841
6837
- // TODO: Set blinded paths
6838
6842
OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
6843
+ .path(path)
6839
6844
}
6840
6845
6841
6846
/// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
6842
6847
/// [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund.
6843
6848
///
6844
6849
/// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
6845
6850
///
6851
+ /// Uses a one-hop [`BlindedPath`] for the refund with [`ChannelManager::get_our_node_id`] as
6852
+ /// the introduction node and a derived payer id for sender privacy.
6853
+ ///
6846
6854
/// [`Refund`]: crate::offers::refund::Refund
6847
6855
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
6848
6856
pub fn create_refund_builder(
@@ -6852,11 +6860,12 @@ where
6852
6860
let expanded_key = &self.inbound_payment_key;
6853
6861
let entropy = &*self.entropy_source;
6854
6862
let secp_ctx = &self.secp_ctx;
6863
+ let path = self.create_one_hop_blinded_path();
6855
6864
6856
- // TODO: Set blinded paths
6857
6865
let builder = RefundBuilder::deriving_payer_id(
6858
6866
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
6859
- )?;
6867
+ )?.path(path);
6868
+
6860
6869
self.pending_outbound_payments
6861
6870
.add_new_awaiting_invoice(payment_id, retry_strategy)
6862
6871
.map_err(|_| Bolt12SemanticError::DuplicatePaymentId)?;
@@ -6964,6 +6973,15 @@ where
6964
6973
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
6965
6974
}
6966
6975
6976
+ /// Creates a one-hop blinded path with [`ChannelManager::get_our_node_id`] as the introduction
6977
+ /// node.
6978
+ fn create_one_hop_blinded_path(&self) -> BlindedPath {
6979
+ let entropy_source = self.entropy_source.deref();
6980
+ let secp_ctx = &self.secp_ctx;
6981
+ BlindedPath::one_hop_for_message(self.get_our_node_id(), entropy_source, secp_ctx).unwrap()
6982
+
6983
+ }
6984
+
6967
6985
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
6968
6986
/// are used when constructing the phantom invoice's route hints.
6969
6987
///
0 commit comments