@@ -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};
@@ -6708,6 +6709,9 @@ where
6708
6709
/// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
6709
6710
/// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer.
6710
6711
///
6712
+ /// Uses a one-hop [`BlindedPath`] for the offer with [`ChannelManager::get_our_node_id`] as the
6713
+ /// introduction node and a derived signing pubkey for recipient privacy.
6714
+ ///
6711
6715
/// [`Offer`]: crate::offers::offer::Offer
6712
6716
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
6713
6717
pub fn create_offer_builder(
@@ -6717,16 +6721,25 @@ where
6717
6721
let expanded_key = &self.inbound_payment_key;
6718
6722
let entropy = &*self.entropy_source;
6719
6723
let secp_ctx = &self.secp_ctx;
6724
+ let builder = OfferBuilder::deriving_signing_pubkey(
6725
+ description, node_id, expanded_key, entropy, secp_ctx
6726
+ );
6720
6727
6721
- // TODO: Set blinded paths
6722
- OfferBuilder::deriving_signing_pubkey(description, node_id, expanded_key, entropy, secp_ctx)
6728
+ match self.create_one_hop_blinded_path() {
6729
+ Ok(path) => builder.path(path),
6730
+ // TODO: check if node is public?
6731
+ Err(_) => builder,
6732
+ }
6723
6733
}
6724
6734
6725
6735
/// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
6726
6736
/// [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund.
6727
6737
///
6728
6738
/// The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
6729
6739
///
6740
+ /// Uses a one-hop [`BlindedPath`] for the refund with [`ChannelManager::get_our_node_id`] as
6741
+ /// the introduction node and a derived payer id for sender privacy.
6742
+ ///
6730
6743
/// [`Refund`]: crate::offers::refund::Refund
6731
6744
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
6732
6745
pub fn create_refund_builder(
@@ -6737,10 +6750,14 @@ where
6737
6750
let entropy = &*self.entropy_source;
6738
6751
let secp_ctx = &self.secp_ctx;
6739
6752
6740
- // TODO: Set blinded paths
6741
6753
let builder = RefundBuilder::deriving_payer_id(
6742
6754
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
6743
6755
)?;
6756
+ let builder = match self.create_one_hop_blinded_path() {
6757
+ Ok(path) => builder.path(path),
6758
+ // TODO: check if node is public?
6759
+ Err(_) => builder,
6760
+ };
6744
6761
self.pending_outbound_payments
6745
6762
.add_new_awaiting_invoice(payment_id, retry_strategy)
6746
6763
.map_err(|_| Bolt12SemanticError::DuplicatePaymentId)?;
@@ -6873,6 +6890,15 @@ where
6873
6890
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
6874
6891
}
6875
6892
6893
+ /// Creates a one-hop blinded path with [`ChannelManager::get_our_node_id`] as the introduction
6894
+ /// node.
6895
+ fn create_one_hop_blinded_path(&self) -> Result<BlindedPath, ()> {
6896
+ let entropy_source = self.entropy_source.deref();
6897
+ let secp_ctx = &self.secp_ctx;
6898
+ BlindedPath::new_for_message(&[self.get_our_node_id()], entropy_source, secp_ctx)
6899
+
6900
+ }
6901
+
6876
6902
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
6877
6903
/// are used when constructing the phantom invoice's route hints.
6878
6904
///
0 commit comments