@@ -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.")
@@ -9624,42 +9615,6 @@ where
9624
9615
.and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
9625
9616
}
9626
9617
9627
- fn enqueue_invoice_request(
9628
- &self,
9629
- invoice_request: InvoiceRequest,
9630
- reply_paths: Vec<BlindedMessagePath>,
9631
- ) -> Result<(), Bolt12SemanticError> {
9632
- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9633
- if !invoice_request.paths().is_empty() {
9634
- reply_paths
9635
- .iter()
9636
- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9637
- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9638
- .for_each(|(path, reply_path)| {
9639
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9640
- destination: Destination::BlindedPath(path.clone()),
9641
- reply_path: reply_path.clone(),
9642
- };
9643
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9644
- pending_offers_messages.push((message, instructions));
9645
- });
9646
- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9647
- for reply_path in reply_paths {
9648
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9649
- destination: Destination::Node(node_id),
9650
- reply_path,
9651
- };
9652
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9653
- pending_offers_messages.push((message, instructions));
9654
- }
9655
- } else {
9656
- debug_assert!(false);
9657
- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9658
- }
9659
-
9660
- Ok(())
9661
- }
9662
-
9663
9618
fn get_current_blocktime(&self) -> Duration {
9664
9619
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9665
9620
}
@@ -9760,13 +9715,6 @@ where
9760
9715
}
9761
9716
}
9762
9717
9763
- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9764
- /// along different paths.
9765
- /// Sending multiple requests increases the chances of successful delivery in case some
9766
- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9767
- /// even if multiple invoices are received.
9768
- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9769
-
9770
9718
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>
9771
9719
where
9772
9720
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13134,7 +13082,6 @@ where
13134
13082
13135
13083
funding_batch_states: Mutex::new(BTreeMap::new()),
13136
13084
13137
- pending_offers_messages: Mutex::new(Vec::new()),
13138
13085
pending_async_payments_messages: Mutex::new(Vec::new()),
13139
13086
13140
13087
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments