@@ -35,7 +35,6 @@ use bitcoin::{secp256k1, Sequence, Weight};
3535use crate::events::FundingInfo;
3636use crate::blinded_path::message::{AsyncPaymentsContext, MessageForwardNode};
3737use crate::blinded_path::NodeIdLookUp;
38- use crate::blinded_path::message::BlindedMessagePath;
3938use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, UnauthenticatedReceiveTlvs};
4039use crate::chain;
4140use crate::chain::{Confirm, ChannelMonitorUpdateStatus, Watch, BestBlock};
@@ -67,13 +66,10 @@ use crate::ln::outbound_payment;
6766use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
6867use crate::offers::invoice::Bolt12Invoice;
6968use crate::offers::invoice::UnsignedBolt12Invoice;
70- use crate::offers::invoice_request::InvoiceRequest;
7169use crate::offers::nonce::Nonce;
72- use crate::offers::parse::Bolt12SemanticError;
7370use crate::offers::signer;
7471use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
75- use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
76- use crate::onion_message::offers::OffersMessage;
72+ use crate::onion_message::messenger::{MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
7773use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
7874use crate::sign::ecdsa::EcdsaChannelSigner;
7975use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
@@ -84,14 +80,20 @@ use crate::util::ser::{BigSize, FixedLengthReader, Readable, ReadableArgs, Maybe
8480use crate::util::ser::TransactionU16LenLimited;
8581use crate::util::logger::{Level, Logger, WithContext};
8682use crate::util::errors::APIError;
87- #[cfg(async_payments)]
88- use crate::offers::static_invoice::StaticInvoice;
8983
9084#[cfg(feature = "dnssec")]
9185use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
9286
87+ #[cfg(async_payments)]
88+ use {
89+ crate::blinded_path::message::{BlindedMessagePath, MessageContext},
90+ crate::offers::static_invoice::StaticInvoice,
91+ crate::onion_message::messenger::Destination,
92+ };
93+
9394#[cfg(not(c_bindings))]
9495use {
96+ crate::onion_message::messenger::DefaultMessageRouter,
9597 crate::routing::router::DefaultRouter,
9698 crate::routing::gossip::NetworkGraph,
9799 crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2169,8 +2171,6 @@ where
21692171//
21702172// Lock order tree:
21712173//
2172- // `pending_offers_messages`
2173- //
21742174// `pending_async_payments_messages`
21752175//
21762176// `total_consistency_lock`
@@ -2418,10 +2418,6 @@ where
24182418 event_persist_notifier: Notifier,
24192419 needs_persist_flag: AtomicBool,
24202420
2421- #[cfg(not(any(test, feature = "_test_utils")))]
2422- pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2423- #[cfg(any(test, feature = "_test_utils"))]
2424- pub(crate) pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
24252421 pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
24262422
24272423 /// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3345,7 +3341,6 @@ where
33453341 needs_persist_flag: AtomicBool::new(false),
33463342 funding_batch_states: Mutex::new(BTreeMap::new()),
33473343
3348- pending_offers_messages: Mutex::new(Vec::new()),
33493344 pending_async_payments_messages: Mutex::new(Vec::new()),
33503345 pending_broadcast_messages: Mutex::new(Vec::new()),
33513346
@@ -9474,10 +9469,6 @@ where
94749469 MR::Target: MessageRouter,
94759470 L::Target: Logger,
94769471{
9477- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9478- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9479- }
9480-
94819472 #[cfg(feature = "dnssec")]
94829473 fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
94839474 self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9534,10 +9525,6 @@ where
95349525 self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
95359526 }
95369527
9537- fn enqueue_invoice_request(&self, invoice_request: InvoiceRequest, reply_paths: Vec<BlindedMessagePath>) -> Result<(), Bolt12SemanticError> {
9538- self.enqueue_invoice_request(invoice_request, reply_paths)
9539- }
9540-
95419528 fn get_current_blocktime(&self) -> Duration {
95429529 Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
95439530 }
@@ -9584,13 +9571,6 @@ where
95849571 }
95859572}
95869573
9587- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9588- /// along different paths.
9589- /// Sending multiple requests increases the chances of successful delivery in case some
9590- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9591- /// even if multiple invoices are received.
9592- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9593-
95949574impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
95959575where
95969576 M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -9603,41 +9583,6 @@ where
96039583 MR::Target: MessageRouter,
96049584 L::Target: Logger,
96059585{
9606- fn enqueue_invoice_request(
9607- &self,
9608- invoice_request: InvoiceRequest,
9609- reply_paths: Vec<BlindedMessagePath>,
9610- ) -> Result<(), Bolt12SemanticError> {
9611- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9612- if !invoice_request.paths().is_empty() {
9613- reply_paths
9614- .iter()
9615- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9616- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9617- .for_each(|(path, reply_path)| {
9618- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9619- destination: Destination::BlindedPath(path.clone()),
9620- reply_path: reply_path.clone(),
9621- };
9622- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9623- pending_offers_messages.push((message, instructions));
9624- });
9625- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9626- for reply_path in reply_paths {
9627- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9628- destination: Destination::Node(node_id),
9629- reply_path,
9630- };
9631- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9632- pending_offers_messages.push((message, instructions));
9633- }
9634- } else {
9635- debug_assert!(false);
9636- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9637- }
9638- Ok(())
9639- }
9640-
96419586 #[cfg(async_payments)]
96429587 pub(super) fn duration_since_epoch(&self) -> Duration {
96439588 #[cfg(not(feature = "std"))]
@@ -13158,7 +13103,6 @@ where
1315813103
1315913104 funding_batch_states: Mutex::new(BTreeMap::new()),
1316013105
13161- pending_offers_messages: Mutex::new(Vec::new()),
1316213106 pending_async_payments_messages: Mutex::new(Vec::new()),
1316313107
1316413108 pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments