@@ -67,15 +67,10 @@ use crate::ln::outbound_payment;
6767use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
6868use crate::offers::invoice::Bolt12Invoice;
6969use crate::offers::invoice::UnsignedBolt12Invoice;
70- use crate::offers::invoice_request::InvoiceRequest;
7170use crate::offers::nonce::Nonce;
72- use crate::offers::parse::Bolt12SemanticError;
7371use crate::offers::signer;
74- #[cfg(async_payments)]
75- use crate::offers::static_invoice::StaticInvoice;
7672use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
77- use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
78- use crate::onion_message::offers::OffersMessage;
73+ use crate::onion_message::messenger::{MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
7974use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
8075use crate::sign::ecdsa::EcdsaChannelSigner;
8176use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
@@ -90,8 +85,15 @@ use crate::util::errors::APIError;
9085#[cfg(feature = "dnssec")]
9186use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
9287
88+ #[cfg(async_payments)]
89+ use {
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},
@@ -2140,8 +2142,6 @@ where
21402142//
21412143// Lock order tree:
21422144//
2143- // `pending_offers_messages`
2144- //
21452145// `pending_async_payments_messages`
21462146//
21472147// `total_consistency_lock`
@@ -2392,10 +2392,6 @@ where
23922392 event_persist_notifier: Notifier,
23932393 needs_persist_flag: AtomicBool,
23942394
2395- #[cfg(not(any(test, feature = "_test_utils")))]
2396- pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2397- #[cfg(any(test, feature = "_test_utils"))]
2398- pub(crate) pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
23992395 pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
24002396
24012397 /// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3315,7 +3311,6 @@ where
33153311 needs_persist_flag: AtomicBool::new(false),
33163312 funding_batch_states: Mutex::new(BTreeMap::new()),
33173313
3318- pending_offers_messages: Mutex::new(Vec::new()),
33193314 pending_async_payments_messages: Mutex::new(Vec::new()),
33203315 pending_broadcast_messages: Mutex::new(Vec::new()),
33213316
@@ -9516,10 +9511,6 @@ where
95169511 MR::Target: MessageRouter,
95179512 L::Target: Logger,
95189513{
9519- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9520- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9521- }
9522-
95239514 #[cfg(feature = "dnssec")]
95249515 fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
95259516 self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9629,42 +9620,6 @@ where
96299620 self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
96309621 }
96319622
9632- fn enqueue_invoice_request(
9633- &self,
9634- invoice_request: InvoiceRequest,
9635- reply_paths: Vec<BlindedMessagePath>,
9636- ) -> Result<(), Bolt12SemanticError> {
9637- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9638- if !invoice_request.paths().is_empty() {
9639- reply_paths
9640- .iter()
9641- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9642- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9643- .for_each(|(path, reply_path)| {
9644- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9645- destination: Destination::BlindedPath(path.clone()),
9646- reply_path: reply_path.clone(),
9647- };
9648- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9649- pending_offers_messages.push((message, instructions));
9650- });
9651- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9652- for reply_path in reply_paths {
9653- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9654- destination: Destination::Node(node_id),
9655- reply_path,
9656- };
9657- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9658- pending_offers_messages.push((message, instructions));
9659- }
9660- } else {
9661- debug_assert!(false);
9662- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9663- }
9664-
9665- Ok(())
9666- }
9667-
96689623 fn get_current_blocktime(&self) -> Duration {
96699624 Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
96709625 }
@@ -9765,13 +9720,6 @@ where
97659720 }
97669721}
97679722
9768- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9769- /// along different paths.
9770- /// Sending multiple requests increases the chances of successful delivery in case some
9771- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9772- /// even if multiple invoices are received.
9773- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9774-
97759723impl<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>
97769724where
97779725 M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13165,7 +13113,6 @@ where
1316513113
1316613114 funding_batch_states: Mutex::new(BTreeMap::new()),
1316713115
13168- pending_offers_messages: Mutex::new(Vec::new()),
1316913116 pending_async_payments_messages: Mutex::new(Vec::new()),
1317013117
1317113118 pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments