@@ -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},
@@ -2126,8 +2128,6 @@ where
2126
2128
//
2127
2129
// Lock order tree:
2128
2130
//
2129
- // `pending_offers_messages`
2130
- //
2131
2131
// `pending_async_payments_messages`
2132
2132
//
2133
2133
// `total_consistency_lock`
@@ -2378,10 +2378,6 @@ where
2378
2378
event_persist_notifier: Notifier,
2379
2379
needs_persist_flag: AtomicBool,
2380
2380
2381
- #[cfg(not(any(test, feature = "_test_utils")))]
2382
- pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2383
- #[cfg(any(test, feature = "_test_utils"))]
2384
- pub(crate) pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2385
2381
pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
2386
2382
2387
2383
/// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3302,7 +3298,6 @@ where
3302
3298
needs_persist_flag: AtomicBool::new(false),
3303
3299
funding_batch_states: Mutex::new(BTreeMap::new()),
3304
3300
3305
- pending_offers_messages: Mutex::new(Vec::new()),
3306
3301
pending_async_payments_messages: Mutex::new(Vec::new()),
3307
3302
pending_broadcast_messages: Mutex::new(Vec::new()),
3308
3303
@@ -9502,10 +9497,6 @@ where
9502
9497
MR::Target: MessageRouter,
9503
9498
L::Target: Logger,
9504
9499
{
9505
- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9506
- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9507
- }
9508
-
9509
9500
#[cfg(feature = "dnssec")]
9510
9501
fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9511
9502
self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9607,42 +9598,6 @@ where
9607
9598
self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
9608
9599
}
9609
9600
9610
- fn enqueue_invoice_request(
9611
- &self,
9612
- invoice_request: InvoiceRequest,
9613
- reply_paths: Vec<BlindedMessagePath>,
9614
- ) -> Result<(), Bolt12SemanticError> {
9615
- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9616
- if !invoice_request.paths().is_empty() {
9617
- reply_paths
9618
- .iter()
9619
- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9620
- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9621
- .for_each(|(path, reply_path)| {
9622
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9623
- destination: Destination::BlindedPath(path.clone()),
9624
- reply_path: reply_path.clone(),
9625
- };
9626
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9627
- pending_offers_messages.push((message, instructions));
9628
- });
9629
- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9630
- for reply_path in reply_paths {
9631
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9632
- destination: Destination::Node(node_id),
9633
- reply_path,
9634
- };
9635
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9636
- pending_offers_messages.push((message, instructions));
9637
- }
9638
- } else {
9639
- debug_assert!(false);
9640
- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9641
- }
9642
-
9643
- Ok(())
9644
- }
9645
-
9646
9601
fn get_current_blocktime(&self) -> Duration {
9647
9602
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9648
9603
}
@@ -9743,13 +9698,6 @@ where
9743
9698
}
9744
9699
}
9745
9700
9746
- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9747
- /// along different paths.
9748
- /// Sending multiple requests increases the chances of successful delivery in case some
9749
- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9750
- /// even if multiple invoices are received.
9751
- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9752
-
9753
9701
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>
9754
9702
where
9755
9703
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13140,7 +13088,6 @@ where
13140
13088
13141
13089
funding_batch_states: Mutex::new(BTreeMap::new()),
13142
13090
13143
- pending_offers_messages: Mutex::new(Vec::new()),
13144
13091
pending_async_payments_messages: Mutex::new(Vec::new()),
13145
13092
13146
13093
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments