@@ -35,7 +35,6 @@ use bitcoin::{secp256k1, Sequence, Weight};
35
35
use crate::events::FundingInfo;
36
36
use crate::blinded_path::message::{AsyncPaymentsContext, MessageForwardNode};
37
37
use crate::blinded_path::NodeIdLookUp;
38
- use crate::blinded_path::message::BlindedMessagePath;
39
38
use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, UnauthenticatedReceiveTlvs};
40
39
use crate::chain;
41
40
use crate::chain::{Confirm, ChannelMonitorUpdateStatus, Watch, BestBlock};
@@ -67,15 +66,10 @@ use crate::ln::outbound_payment;
67
66
use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
68
67
use crate::offers::invoice::Bolt12Invoice;
69
68
use crate::offers::invoice::UnsignedBolt12Invoice;
70
- use crate::offers::invoice_request::InvoiceRequest;
71
69
use crate::offers::nonce::Nonce;
72
- use crate::offers::parse::Bolt12SemanticError;
73
70
use crate::offers::signer;
74
- #[cfg(async_payments)]
75
- use crate::offers::static_invoice::StaticInvoice;
76
71
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;
72
+ use crate::onion_message::messenger::{MessageRouter, MessageSendInstructions, Responder, ResponseInstruction};
79
73
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
80
74
use crate::sign::ecdsa::EcdsaChannelSigner;
81
75
use crate::util::config::{UserConfig, ChannelConfig, ChannelConfigUpdate};
@@ -90,8 +84,15 @@ use crate::util::errors::APIError;
90
84
#[cfg(feature = "dnssec")]
91
85
use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
92
86
87
+ #[cfg(async_payments)]
88
+ use {
89
+ crate::offers::static_invoice::StaticInvoice,
90
+ crate::onion_message::messenger::Destination,
91
+ };
92
+
93
93
#[cfg(not(c_bindings))]
94
94
use {
95
+ crate::onion_message::messenger::DefaultMessageRouter,
95
96
crate::routing::router::DefaultRouter,
96
97
crate::routing::gossip::NetworkGraph,
97
98
crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2145,8 +2146,6 @@ where
2145
2146
//
2146
2147
// Lock order tree:
2147
2148
//
2148
- // `pending_offers_messages`
2149
- //
2150
2149
// `pending_async_payments_messages`
2151
2150
//
2152
2151
// `total_consistency_lock`
@@ -2397,10 +2396,6 @@ where
2397
2396
event_persist_notifier: Notifier,
2398
2397
needs_persist_flag: AtomicBool,
2399
2398
2400
- #[cfg(not(any(test, feature = "_test_utils")))]
2401
- pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2402
- #[cfg(any(test, feature = "_test_utils"))]
2403
- pub(crate) pending_offers_messages: Mutex<Vec<(OffersMessage, MessageSendInstructions)>>,
2404
2399
pending_async_payments_messages: Mutex<Vec<(AsyncPaymentsMessage, MessageSendInstructions)>>,
2405
2400
2406
2401
/// Tracks the message events that are to be broadcasted when we are connected to some peer.
@@ -3320,7 +3315,6 @@ where
3320
3315
needs_persist_flag: AtomicBool::new(false),
3321
3316
funding_batch_states: Mutex::new(BTreeMap::new()),
3322
3317
3323
- pending_offers_messages: Mutex::new(Vec::new()),
3324
3318
pending_async_payments_messages: Mutex::new(Vec::new()),
3325
3319
pending_broadcast_messages: Mutex::new(Vec::new()),
3326
3320
@@ -9599,10 +9593,6 @@ where
9599
9593
MR::Target: MessageRouter,
9600
9594
L::Target: Logger,
9601
9595
{
9602
- fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>> {
9603
- self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9604
- }
9605
-
9606
9596
#[cfg(feature = "dnssec")]
9607
9597
fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9608
9598
self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
@@ -9659,10 +9649,6 @@ where
9659
9649
self.pending_outbound_payments.release_invoice_requests_awaiting_invoice()
9660
9650
}
9661
9651
9662
- fn enqueue_invoice_request(&self, invoice_request: InvoiceRequest, reply_paths: Vec<BlindedMessagePath>) -> Result<(), Bolt12SemanticError> {
9663
- self.enqueue_invoice_request(invoice_request, reply_paths)
9664
- }
9665
-
9666
9652
fn get_current_blocktime(&self) -> Duration {
9667
9653
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64)
9668
9654
}
@@ -9709,13 +9695,6 @@ where
9709
9695
}
9710
9696
}
9711
9697
9712
- /// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
9713
- /// along different paths.
9714
- /// Sending multiple requests increases the chances of successful delivery in case some
9715
- /// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
9716
- /// even if multiple invoices are received.
9717
- pub const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
9718
-
9719
9698
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>
9720
9699
where
9721
9700
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
@@ -9728,41 +9707,6 @@ where
9728
9707
MR::Target: MessageRouter,
9729
9708
L::Target: Logger,
9730
9709
{
9731
- fn enqueue_invoice_request(
9732
- &self,
9733
- invoice_request: InvoiceRequest,
9734
- reply_paths: Vec<BlindedMessagePath>,
9735
- ) -> Result<(), Bolt12SemanticError> {
9736
- let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap();
9737
- if !invoice_request.paths().is_empty() {
9738
- reply_paths
9739
- .iter()
9740
- .flat_map(|reply_path| invoice_request.paths().iter().map(move |path| (path, reply_path)))
9741
- .take(OFFERS_MESSAGE_REQUEST_LIMIT)
9742
- .for_each(|(path, reply_path)| {
9743
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9744
- destination: Destination::BlindedPath(path.clone()),
9745
- reply_path: reply_path.clone(),
9746
- };
9747
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9748
- pending_offers_messages.push((message, instructions));
9749
- });
9750
- } else if let Some(node_id) = invoice_request.issuer_signing_pubkey() {
9751
- for reply_path in reply_paths {
9752
- let instructions = MessageSendInstructions::WithSpecifiedReplyPath {
9753
- destination: Destination::Node(node_id),
9754
- reply_path,
9755
- };
9756
- let message = OffersMessage::InvoiceRequest(invoice_request.clone());
9757
- pending_offers_messages.push((message, instructions));
9758
- }
9759
- } else {
9760
- debug_assert!(false);
9761
- return Err(Bolt12SemanticError::MissingIssuerSigningPubkey);
9762
- }
9763
- Ok(())
9764
- }
9765
-
9766
9710
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
9767
9711
/// to pay us.
9768
9712
///
@@ -13206,7 +13150,6 @@ where
13206
13150
13207
13151
funding_batch_states: Mutex::new(BTreeMap::new()),
13208
13152
13209
- pending_offers_messages: Mutex::new(Vec::new()),
13210
13153
pending_async_payments_messages: Mutex::new(Vec::new()),
13211
13154
13212
13155
pending_broadcast_messages: Mutex::new(Vec::new()),
0 commit comments