@@ -65,15 +65,10 @@ use crate::ln::outbound_payment;
65
65
use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
66
66
use crate::offers::invoice::Bolt12Invoice;
67
67
use crate::offers::invoice::UnsignedBolt12Invoice;
68
- use crate::offers::invoice_request::InvoiceRequest;
69
68
use crate::offers::nonce::Nonce;
70
- use crate::offers::parse::Bolt12SemanticError;
71
69
use crate::offers::signer;
72
- #[cfg(async_payments)]
73
- use crate::offers::static_invoice::StaticInvoice;
74
70
use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
75
- use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
76
- use crate::onion_message::offers::OffersMessage;
71
+ use crate::onion_message::messenger::{MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
77
72
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
78
73
use crate::sign::ecdsa::EcdsaChannelSigner;
79
74
use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
@@ -88,8 +83,15 @@ use crate::util::errors::APIError;
88
83
#[cfg(feature = "dnssec")]
89
84
use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
90
85
86
+ #[cfg(async_payments)]
87
+ use {
88
+ crate::offers::static_invoice::StaticInvoice,
89
+ crate::onion_message::messenger::Destination,
90
+ };
91
+
91
92
#[cfg(not(c_bindings))]
92
93
use {
94
+ crate::onion_message::messenger::DefaultMessageRouter,
93
95
crate::routing::router::DefaultRouter,
94
96
crate::routing::gossip::NetworkGraph,
95
97
crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2108,8 +2110,6 @@ where
2108
2110
//
2109
2111
// Lock order tree:
2110
2112
//
2111
- // `pending_offers_messages`
2112
- //
2113
2113
// `pending_async_payments_messages`
2114
2114
//
2115
2115
// `total_consistency_lock`
@@ -2358,10 +2358,6 @@ where
2358
2358
event_persist_notifier: Notifier,
2359
2359
needs_persist_flag: AtomicBool,
2360
2360
2361
- #[cfg(not(any(test, feature = "_test_utils")))]
2362
- pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2363
- #[cfg(any(test, feature = "_test_utils"))]
2364
- pub(crate) pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2365
2361
pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
2366
2362
2367
2363
/// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3224,7 +3220,6 @@ where
3224
3220
needs_persist_flag: AtomicBool::new(false),
3225
3221
funding_batch_states: Mutex::new(BTreeMap::new()),
3226
3222
3227
- pending_offers_messages: Mutex::new(Vec::new()),
3228
3223
pending_async_payments_messages: Mutex::new(Vec::new()),
3229
3224
pending_broadcast_messages: Mutex::new(Vec::new()),
3230
3225
@@ -9424,10 +9419,6 @@ where
9424
9419
MR::Target: MessageRouter,
9425
9420
L::Target: Logger,
9426
9421
{
9427
- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9428
- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9429
- }
9430
-
9431
9422
#[cfg(feature = "dnssec")]
9432
9423
fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9433
9424
self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9546,42 +9537,6 @@ where
9546
9537
.and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(()))
9547
9538
}
9548
9539
9549
- fn enqueue_invoice_request(
9550
- &self,
9551
- invoice_request: InvoiceRequest,
9552
- reply_paths: Vec<BlindedMessagePath>,
9553
- ) -> Result<(), Bolt12SemanticError> {
9554
- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9555
- if !invoice_request.paths().is_empty() {
9556
- reply_paths
9557
- .iter()
9558
- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9559
- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9560
- .for_each(|(path, reply_path)| {
9561
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9562
- destination: Destination::BlindedPath(path.clone()),
9563
- reply_path: reply_path.clone(),
9564
- };
9565
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9566
- pending_offers_messages.push((message, instructions));
9567
- });
9568
- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9569
- for reply_path in reply_paths {
9570
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9571
- destination: Destination::Node(node_id),
9572
- reply_path,
9573
- };
9574
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9575
- pending_offers_messages.push((message, instructions));
9576
- }
9577
- } else {
9578
- debug_assert!(false);
9579
- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9580
- }
9581
-
9582
- Ok(())
9583
- }
9584
-
9585
9540
fn get_current_blocktime(&self) -> Duration {
9586
9541
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9587
9542
}
@@ -9682,13 +9637,6 @@ where
9682
9637
}
9683
9638
}
9684
9639
9685
- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9686
- /// along different paths.
9687
- /// Sending multiple requests increases the chances of successful delivery in case some
9688
- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9689
- /// even if multiple invoices are received.
9690
- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9691
-
9692
9640
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>
9693
9641
where
9694
9642
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -13024,7 +12972,6 @@ where
13024
12972
13025
12973
funding_batch_states: Mutex::new(BTreeMap::new()),
13026
12974
13027
- pending_offers_messages: Mutex::new(Vec::new()),
13028
12975
pending_async_payments_messages: Mutex::new(Vec::new()),
13029
12976
13030
12977
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments