@@ -74,7 +74,7 @@ use crate::offers::signer;
74
74
use crate::offers::static_invoice::StaticInvoice;
75
75
use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
76
76
use crate::onion_message::dns_resolution::HumanReadableName;
77
- use crate::onion_message::messenger::{Destination, MessageRouter, Responder, ResponseInstruction, MessageSendInstructions };
77
+ use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, MessageSendInstructions, Responder, ResponseInstruction };
78
78
use crate::onion_message::offers::OffersMessage;
79
79
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
80
80
use crate::sign::ecdsa::EcdsaChannelSigner;
@@ -88,13 +88,10 @@ use crate::util::logger::{Level, Logger, WithContext};
88
88
use crate::util::errors::APIError;
89
89
90
90
#[cfg(feature = "dnssec")]
91
- use crate::blinded_path::message::DNSResolverContext;
92
- #[cfg(feature = "dnssec")]
93
- use crate::onion_message::dns_resolution::{DNSResolverMessage, DNSResolverMessageHandler, DNSSECQuery, DNSSECProof, OMNameResolver};
91
+ use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
94
92
95
93
#[cfg(not(c_bindings))]
96
94
use {
97
- crate::onion_message::messenger::DefaultMessageRouter,
98
95
crate::routing::router::DefaultRouter,
99
96
crate::routing::gossip::NetworkGraph,
100
97
crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2397,14 +2394,6 @@ where
2397
2394
#[cfg(feature = "dnssec")]
2398
2395
pending_dns_onion_messages: Mutex<Vec<(DNSResolverMessage, MessageSendInstructions)>>,
2399
2396
2400
- #[cfg(feature = "_test_utils")]
2401
- /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
2402
- /// offer generated in the test.
2403
- ///
2404
- /// This allows for doing so, validating proofs as normal, but, if they pass, replacing the
2405
- /// offer they resolve to to the given one.
2406
- pub testing_dnssec_proof_offer_resolution_override: Mutex<HashMap<HumanReadableName, Offer>>,
2407
-
2408
2397
#[cfg(test)]
2409
2398
pub(super) entropy_source: ES,
2410
2399
#[cfg(not(test))]
@@ -3278,9 +3267,6 @@ where
3278
3267
hrn_resolver: OMNameResolver::new(current_timestamp, params.best_block.height),
3279
3268
#[cfg(feature = "dnssec")]
3280
3269
pending_dns_onion_messages: Mutex::new(Vec::new()),
3281
-
3282
- #[cfg(feature = "_test_utils")]
3283
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
3284
3270
}
3285
3271
}
3286
3272
@@ -9747,6 +9733,18 @@ where
9747
9733
9748
9734
self.enqueue_invoice_request(invoice_request, reply_paths)
9749
9735
}
9736
+
9737
+ #[cfg(feature = "dnssec")]
9738
+ fn amt_msats_for_payment_awaiting_offer(&self, payment_id: PaymentId) -> Result<u64, ()> {
9739
+ self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id)
9740
+ }
9741
+
9742
+ #[cfg(feature = "dnssec")]
9743
+ fn received_offer(
9744
+ &self, payment_id: PaymentId, retryable_invoice_request: Option<RetryableInvoiceRequest>,
9745
+ ) -> Result<(), ()> {
9746
+ self.pending_outbound_payments.received_offer(payment_id, retryable_invoice_request)
9747
+ }
9750
9748
}
9751
9749
9752
9750
/// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
@@ -11298,69 +11296,6 @@ where
11298
11296
}
11299
11297
}
11300
11298
11301
- #[cfg(feature = "dnssec")]
11302
- impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11303
- DNSResolverMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11304
- where
11305
- M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
11306
- T::Target: BroadcasterInterface,
11307
- ES::Target: EntropySource,
11308
- NS::Target: NodeSigner,
11309
- SP::Target: SignerProvider,
11310
- F::Target: FeeEstimator,
11311
- R::Target: Router,
11312
- MR::Target: MessageRouter,
11313
- L::Target: Logger,
11314
- {
11315
- fn handle_dnssec_query(
11316
- &self, _message: DNSSECQuery, _responder: Option<Responder>,
11317
- ) -> Option<(DNSResolverMessage, ResponseInstruction)> {
11318
- None
11319
- }
11320
-
11321
- fn handle_dnssec_proof(&self, message: DNSSECProof, context: DNSResolverContext) {
11322
- let offer_opt = self.hrn_resolver.handle_dnssec_proof_for_offer(message, context);
11323
- #[cfg_attr(not(feature = "_test_utils"), allow(unused_mut))]
11324
- if let Some((completed_requests, mut offer)) = offer_opt {
11325
- for (name, payment_id) in completed_requests {
11326
- #[cfg(feature = "_test_utils")]
11327
- if let Some(replacement_offer) = self.testing_dnssec_proof_offer_resolution_override.lock().unwrap().remove(&name) {
11328
- // If we have multiple pending requests we may end up over-using the override
11329
- // offer, but tests can deal with that.
11330
- offer = replacement_offer;
11331
- }
11332
- if let Ok(amt_msats) = self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id) {
11333
- let offer_pay_res =
11334
- self.pay_for_offer_intern(&offer, None, Some(amt_msats), None, payment_id, Some(name),
11335
- |invoice_request, nonce| {
11336
- let retryable_invoice_request = RetryableInvoiceRequest {
11337
- invoice_request: invoice_request.clone(),
11338
- nonce,
11339
- };
11340
- self.pending_outbound_payments
11341
- .received_offer(payment_id, Some(retryable_invoice_request))
11342
- .map_err(|_| Bolt12SemanticError::DuplicatePaymentId)
11343
- });
11344
- if offer_pay_res.is_err() {
11345
- // The offer we tried to pay is the canonical current offer for the name we
11346
- // wanted to pay. If we can't pay it, there's no way to recover so fail the
11347
- // payment.
11348
- // Note that the PaymentFailureReason should be ignored for an
11349
- // AwaitingInvoice payment.
11350
- self.pending_outbound_payments.abandon_payment(
11351
- payment_id, PaymentFailureReason::RouteNotFound, &self.pending_events,
11352
- );
11353
- }
11354
- }
11355
- }
11356
- }
11357
- }
11358
-
11359
- fn release_pending_messages(&self) -> Vec<(DNSResolverMessage, MessageSendInstructions)> {
11360
- core::mem::take(&mut self.pending_dns_onion_messages.lock().unwrap())
11361
- }
11362
- }
11363
-
11364
11299
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11365
11300
NodeIdLookUp for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11366
11301
where
@@ -13213,9 +13148,6 @@ where
13213
13148
hrn_resolver: OMNameResolver::new(highest_seen_timestamp, best_block_height),
13214
13149
#[cfg(feature = "dnssec")]
13215
13150
pending_dns_onion_messages: Mutex::new(Vec::new()),
13216
-
13217
- #[cfg(feature = "_test_utils")]
13218
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
13219
13151
};
13220
13152
13221
13153
for (_, monitor) in args.channel_monitors.iter() {
0 commit comments