@@ -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
@@ -9545,10 +9540,6 @@ where
9545
9540
MR::Target: MessageRouter,
9546
9541
L::Target: Logger,
9547
9542
{
9548
- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9549
- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9550
- }
9551
-
9552
9543
#[cfg(feature = "dnssec")]
9553
9544
fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9554
9545
self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9658,42 +9649,6 @@ where
9658
9649
self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
9659
9650
}
9660
9651
9661
- fn enqueue_invoice_request(
9662
- &self,
9663
- invoice_request: InvoiceRequest,
9664
- reply_paths: Vec<BlindedMessagePath>,
9665
- ) -> Result<(), Bolt12SemanticError> {
9666
- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9667
- if !invoice_request.paths().is_empty() {
9668
- reply_paths
9669
- .iter()
9670
- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9671
- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9672
- .for_each(|(path, reply_path)| {
9673
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9674
- destination: Destination::BlindedPath(path.clone()),
9675
- reply_path: reply_path.clone(),
9676
- };
9677
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9678
- pending_offers_messages.push((message, instructions));
9679
- });
9680
- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9681
- for reply_path in reply_paths {
9682
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9683
- destination: Destination::Node(node_id),
9684
- reply_path,
9685
- };
9686
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9687
- pending_offers_messages.push((message, instructions));
9688
- }
9689
- } else {
9690
- debug_assert!(false);
9691
- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9692
- }
9693
-
9694
- Ok(())
9695
- }
9696
-
9697
9652
fn get_current_blocktime(&self) -> Duration {
9698
9653
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9699
9654
}
@@ -9794,13 +9749,6 @@ where
9794
9749
}
9795
9750
}
9796
9751
9797
- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9798
- /// along different paths.
9799
- /// Sending multiple requests increases the chances of successful delivery in case some
9800
- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9801
- /// even if multiple invoices are received.
9802
- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9803
-
9804
9752
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>
9805
9753
where
9806
9754
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13194,7 +13142,6 @@ where
13194
13142
13195
13143
funding_batch_states: Mutex::new(BTreeMap::new()),
13196
13144
13197
- pending_offers_messages: Mutex::new(Vec::new()),
13198
13145
pending_async_payments_messages: Mutex::new(Vec::new()),
13199
13146
13200
13147
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments