@@ -67,15 +67,10 @@ use crate::ln::outbound_payment;
67
67
use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
68
68
use crate::offers::invoice::Bolt12Invoice;
69
69
use crate::offers::invoice::UnsignedBolt12Invoice;
70
- use crate::offers::invoice_request::InvoiceRequest;
71
70
use crate::offers::nonce::Nonce;
72
- use crate::offers::parse::Bolt12SemanticError;
73
71
use crate::offers::signer;
74
- #[cfg(async_payments)]
75
- use crate::offers::static_invoice::StaticInvoice;
76
72
use 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};
79
74
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
80
75
use crate::sign::ecdsa::EcdsaChannelSigner;
81
76
use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
@@ -90,8 +85,15 @@ use crate::util::errors::APIError;
90
85
#[cfg(feature = "dnssec")]
91
86
use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
92
87
88
+ #[cfg(async_payments)]
89
+ use {
90
+ crate::offers::static_invoice::StaticInvoice,
91
+ crate::onion_message::messenger::Destination,
92
+ };
93
+
93
94
#[cfg(not(c_bindings))]
94
95
use {
96
+ crate::onion_message::messenger::DefaultMessageRouter,
95
97
crate::routing::router::DefaultRouter,
96
98
crate::routing::gossip::NetworkGraph,
97
99
crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2140,8 +2142,6 @@ where
2140
2142
//
2141
2143
// Lock order tree:
2142
2144
//
2143
- // `pending_offers_messages`
2144
- //
2145
2145
// `pending_async_payments_messages`
2146
2146
//
2147
2147
// `total_consistency_lock`
@@ -2392,10 +2392,6 @@ where
2392
2392
event_persist_notifier: Notifier,
2393
2393
needs_persist_flag: AtomicBool,
2394
2394
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)>>,
2399
2395
pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
2400
2396
2401
2397
/// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3315,7 +3311,6 @@ where
3315
3311
needs_persist_flag: AtomicBool::new(false),
3316
3312
funding_batch_states: Mutex::new(BTreeMap::new()),
3317
3313
3318
- pending_offers_messages: Mutex::new(Vec::new()),
3319
3314
pending_async_payments_messages: Mutex::new(Vec::new()),
3320
3315
pending_broadcast_messages: Mutex::new(Vec::new()),
3321
3316
@@ -9516,10 +9511,6 @@ where
9516
9511
MR::Target: MessageRouter,
9517
9512
L::Target: Logger,
9518
9513
{
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
-
9523
9514
#[cfg(feature = "dnssec")]
9524
9515
fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9525
9516
self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9629,42 +9620,6 @@ where
9629
9620
self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
9630
9621
}
9631
9622
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
-
9668
9623
fn get_current_blocktime(&self) -> Duration {
9669
9624
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9670
9625
}
@@ -9765,13 +9720,6 @@ where
9765
9720
}
9766
9721
}
9767
9722
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
-
9775
9723
impl<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>
9776
9724
where
9777
9725
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13165,7 +13113,6 @@ where
13165
13113
13166
13114
funding_batch_states: Mutex::new(BTreeMap::new()),
13167
13115
13168
- pending_offers_messages: Mutex::new(Vec::new()),
13169
13116
pending_async_payments_messages: Mutex::new(Vec::new()),
13170
13117
13171
13118
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments