@@ -31,7 +31,7 @@ use bitcoin::secp256k1::{SecretKey,PublicKey};
31
31
use bitcoin::secp256k1::Secp256k1;
32
32
use bitcoin::{secp256k1, Sequence};
33
33
34
- use crate::blinded_path::message::OffersData;
34
+ use crate::blinded_path::message::{ OffersData, RecipientData} ;
35
35
use crate::blinded_path::{BlindedPath, NodeIdLookUp};
36
36
use crate::blinded_path::message::ForwardNode;
37
37
use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, PaymentConstraints, PaymentContext, ReceiveTlvs};
@@ -8335,7 +8335,7 @@ macro_rules! create_offer_builder { ($self: ident, $builder: ty) => {
8335
8335
let entropy = &*$self.entropy_source;
8336
8336
let secp_ctx = &$self.secp_ctx;
8337
8337
8338
- let path = $self.create_blinded_path_using_absolute_expiry(absolute_expiry)
8338
+ let path = $self.create_blinded_path_using_absolute_expiry(absolute_expiry, None )
8339
8339
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
8340
8340
let builder = OfferBuilder::deriving_signing_pubkey(
8341
8341
node_id, expanded_key, entropy, secp_ctx
@@ -8407,7 +8407,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
8407
8407
let entropy = &*$self.entropy_source;
8408
8408
let secp_ctx = &$self.secp_ctx;
8409
8409
8410
- let path = $self.create_blinded_path_using_absolute_expiry(Some(absolute_expiry))
8410
+ let recipient_tlvs = RecipientData::new_for_offers(Some(payment_id));
8411
+ let path = $self.create_blinded_path_using_absolute_expiry(Some(absolute_expiry), Some(recipient_tlvs))
8411
8412
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
8412
8413
let builder = RefundBuilder::deriving_payer_id(
8413
8414
node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
@@ -8530,7 +8531,8 @@ where
8530
8531
Some(payer_note) => builder.payer_note(payer_note),
8531
8532
};
8532
8533
let invoice_request = builder.build_and_sign()?;
8533
- let reply_path = self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?;
8534
+ let recipient_tlvs = RecipientData::new_for_offers(Some(payment_id));
8535
+ let reply_path = self.create_blinded_path(Some(recipient_tlvs)).map_err(|_| Bolt12SemanticError::MissingPaths)?;
8534
8536
8535
8537
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
8536
8538
@@ -8630,7 +8632,7 @@ where
8630
8632
)?;
8631
8633
let builder: InvoiceBuilder<DerivedSigningPubkey> = builder.into();
8632
8634
let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?;
8633
- let reply_path = self.create_blinded_path()
8635
+ let reply_path = self.create_blinded_path(None )
8634
8636
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
8635
8637
8636
8638
let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
@@ -8763,15 +8765,15 @@ where
8763
8765
/// respectively, based on the given `absolute_expiry` as seconds since the Unix epoch. See
8764
8766
/// [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`].
8765
8767
fn create_blinded_path_using_absolute_expiry(
8766
- &self, absolute_expiry: Option<Duration>
8768
+ &self, absolute_expiry: Option<Duration>, recipient_tlvs: Option<RecipientData>
8767
8769
) -> Result<BlindedPath, ()> {
8768
8770
let now = self.duration_since_epoch();
8769
8771
let max_short_lived_absolute_expiry = now.saturating_add(MAX_SHORT_LIVED_RELATIVE_EXPIRY);
8770
8772
8771
8773
if absolute_expiry.unwrap_or(Duration::MAX) <= max_short_lived_absolute_expiry {
8772
- self.create_compact_blinded_path()
8774
+ self.create_compact_blinded_path(recipient_tlvs )
8773
8775
} else {
8774
- self.create_blinded_path()
8776
+ self.create_blinded_path(recipient_tlvs )
8775
8777
}
8776
8778
}
8777
8779
@@ -8791,7 +8793,7 @@ where
8791
8793
/// Creates a blinded path by delegating to [`MessageRouter::create_blinded_paths`].
8792
8794
///
8793
8795
/// Errors if the `MessageRouter` errors or returns an empty `Vec`.
8794
- fn create_blinded_path(&self) -> Result<BlindedPath, ()> {
8796
+ fn create_blinded_path(&self, recipient_tlvs: Option<RecipientData> ) -> Result<BlindedPath, ()> {
8795
8797
let recipient = self.get_our_node_id();
8796
8798
let secp_ctx = &self.secp_ctx;
8797
8799
@@ -8804,14 +8806,14 @@ where
8804
8806
.collect::<Vec<_>>();
8805
8807
8806
8808
self.router
8807
- .create_blinded_paths(recipient, peers, secp_ctx)
8809
+ .create_blinded_paths(recipient, recipient_tlvs, peers, secp_ctx)
8808
8810
.and_then(|paths| paths.into_iter().next().ok_or(()))
8809
8811
}
8810
8812
8811
8813
/// Creates a blinded path by delegating to [`MessageRouter::create_compact_blinded_paths`].
8812
8814
///
8813
8815
/// Errors if the `MessageRouter` errors or returns an empty `Vec`.
8814
- fn create_compact_blinded_path(&self) -> Result<BlindedPath, ()> {
8816
+ fn create_compact_blinded_path(&self, recipient_tlvs: Option<RecipientData> ) -> Result<BlindedPath, ()> {
8815
8817
let recipient = self.get_our_node_id();
8816
8818
let secp_ctx = &self.secp_ctx;
8817
8819
@@ -8831,7 +8833,7 @@ where
8831
8833
.collect::<Vec<_>>();
8832
8834
8833
8835
self.router
8834
- .create_compact_blinded_paths(recipient, peers, secp_ctx)
8836
+ .create_compact_blinded_paths(recipient, recipient_tlvs, peers, secp_ctx)
8835
8837
.and_then(|paths| paths.into_iter().next().ok_or(()))
8836
8838
}
8837
8839
0 commit comments