@@ -36,7 +36,7 @@ use crate::events::FundingInfo;
36
36
use crate::blinded_path::message::{AsyncPaymentsContext, MessageContext, OffersContext};
37
37
use crate::blinded_path::NodeIdLookUp;
38
38
use crate::blinded_path::message::{BlindedMessagePath, MessageForwardNode};
39
- use crate::blinded_path::payment::{AsyncBolt12OfferContext, BlindedPaymentPath, Bolt12OfferContext, PaymentConstraints , PaymentContext, UnauthenticatedReceiveTlvs};
39
+ use crate::blinded_path::payment::{AsyncBolt12OfferContext, Bolt12OfferContext, PaymentContext, UnauthenticatedReceiveTlvs};
40
40
use crate::chain;
41
41
use crate::chain::{Confirm, ChannelMonitorUpdateStatus, Watch, BestBlock};
42
42
use crate::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator, LowerBoundedFeeEstimator};
@@ -90,7 +90,8 @@ use crate::util::logger::{Level, Logger, WithContext};
90
90
use crate::util::errors::APIError;
91
91
#[cfg(async_payments)]
92
92
use crate::offers::static_invoice::{StaticInvoice, StaticInvoiceBuilder};
93
-
93
+ #[cfg(all(test, async_payments))]
94
+ use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints};
94
95
#[cfg(feature = "dnssec")]
95
96
use crate::blinded_path::message::DNSResolverContext;
96
97
#[cfg(feature = "dnssec")]
@@ -10534,25 +10535,6 @@ where
10534
10535
inbound_payment::get_payment_preimage(payment_hash, payment_secret, &self.inbound_payment_key)
10535
10536
}
10536
10537
10537
- /// Creates a collection of blinded paths by delegating to [`MessageRouter`] based on
10538
- /// the path's intended lifetime.
10539
- ///
10540
- /// Whether or not the path is compact depends on whether the path is short-lived or long-lived,
10541
- /// respectively, based on the given `absolute_expiry` as seconds since the Unix epoch. See
10542
- /// [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`].
10543
- fn create_blinded_paths_using_absolute_expiry(
10544
- &self, context: OffersContext, absolute_expiry: Option<Duration>,
10545
- ) -> Result<Vec<BlindedMessagePath>, ()> {
10546
- let now = self.duration_since_epoch();
10547
- let max_short_lived_absolute_expiry = now.saturating_add(MAX_SHORT_LIVED_RELATIVE_EXPIRY);
10548
-
10549
- if absolute_expiry.unwrap_or(Duration::MAX) <= max_short_lived_absolute_expiry {
10550
- self.create_compact_blinded_paths(context)
10551
- } else {
10552
- self.create_blinded_paths(MessageContext::Offers(context))
10553
- }
10554
- }
10555
-
10556
10538
pub(super) fn duration_since_epoch(&self) -> Duration {
10557
10539
#[cfg(not(feature = "std"))]
10558
10540
let now = Duration::from_secs(
@@ -10583,42 +10565,10 @@ where
10583
10565
.collect::<Vec<_>>()
10584
10566
}
10585
10567
10586
- /// Creates a collection of blinded paths by delegating to
10587
- /// [`MessageRouter::create_blinded_paths`].
10588
- ///
10589
- /// Errors if the `MessageRouter` errors.
10590
- fn create_blinded_paths(&self, context: MessageContext) -> Result<Vec<BlindedMessagePath>, ()> {
10591
- let recipient = self.get_our_node_id();
10592
- let secp_ctx = &self.secp_ctx;
10593
-
10594
- let peers = self.get_peers_for_blinded_path()
10595
- .into_iter()
10596
- .map(|node| node.node_id)
10597
- .collect();
10598
-
10599
- self.message_router
10600
- .create_blinded_paths(recipient, context, peers, secp_ctx)
10601
- .and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
10602
- }
10603
-
10604
- /// Creates a collection of blinded paths by delegating to
10605
- /// [`MessageRouter::create_compact_blinded_paths`].
10606
- ///
10607
- /// Errors if the `MessageRouter` errors.
10608
- fn create_compact_blinded_paths(&self, context: OffersContext) -> Result<Vec<BlindedMessagePath>, ()> {
10609
- let recipient = self.get_our_node_id();
10610
- let secp_ctx = &self.secp_ctx;
10611
-
10612
- let peers = self.get_peers_for_blinded_path();
10613
-
10614
- self.message_router
10615
- .create_compact_blinded_paths(recipient, MessageContext::Offers(context), peers, secp_ctx)
10616
- .and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
10617
- }
10618
-
10568
+ #[cfg(all(test, async_payments))]
10619
10569
/// Creates multi-hop blinded payment paths for the given `amount_msats` by delegating to
10620
10570
/// [`Router::create_blinded_payment_paths`].
10621
- fn create_blinded_payment_paths (
10571
+ fn test_create_blinded_payment_paths (
10622
10572
&self, amount_msats: Option<u64>, payment_secret: PaymentSecret, payment_context: PaymentContext,
10623
10573
relative_expiry_seconds: u32
10624
10574
) -> Result<Vec<BlindedPaymentPath>, ()> {
@@ -10652,16 +10602,6 @@ where
10652
10602
)
10653
10603
}
10654
10604
10655
- #[cfg(all(test, async_payments))]
10656
- pub(super) fn test_create_blinded_payment_paths(
10657
- &self, amount_msats: Option<u64>, payment_secret: PaymentSecret, payment_context: PaymentContext,
10658
- relative_expiry_seconds: u32
10659
- ) -> Result<Vec<BlindedPaymentPath>, ()> {
10660
- self.create_blinded_payment_paths(
10661
- amount_msats, payment_secret, payment_context, relative_expiry_seconds
10662
- )
10663
- }
10664
-
10665
10605
/// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
10666
10606
/// are used when constructing the phantom invoice's route hints.
10667
10607
///
0 commit comments