@@ -76,7 +76,7 @@ use crate::offers::signer;
76
76
use crate::offers::static_invoice::StaticInvoice;
77
77
use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
78
78
use crate::onion_message::dns_resolution::HumanReadableName;
79
- use crate::onion_message::messenger::{Destination, MessageRouter, Responder, ResponseInstruction, MessageSendInstructions };
79
+ use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, MessageSendInstructions, Responder, ResponseInstruction };
80
80
use crate::onion_message::offers::OffersMessage;
81
81
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
82
82
use crate::sign::ecdsa::EcdsaChannelSigner;
@@ -90,13 +90,10 @@ use crate::util::logger::{Level, Logger, WithContext};
90
90
use crate::util::errors::APIError;
91
91
92
92
#[cfg(feature = "dnssec")]
93
- use crate::blinded_path::message::DNSResolverContext;
94
- #[cfg(feature = "dnssec")]
95
- use crate::onion_message::dns_resolution::{DNSResolverMessage, DNSResolverMessageHandler, DNSSECQuery, DNSSECProof, OMNameResolver};
93
+ use crate::onion_message::dns_resolution::{DNSResolverMessage, OMNameResolver};
96
94
97
95
#[cfg(not(c_bindings))]
98
96
use {
99
- crate::onion_message::messenger::DefaultMessageRouter,
100
97
crate::routing::router::DefaultRouter,
101
98
crate::routing::gossip::NetworkGraph,
102
99
crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters},
@@ -2412,14 +2409,6 @@ where
2412
2409
#[cfg(feature = "dnssec")]
2413
2410
pending_dns_onion_messages: Mutex<Vec<(DNSResolverMessage, MessageSendInstructions)>>,
2414
2411
2415
- #[cfg(feature = "_test_utils")]
2416
- /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
2417
- /// offer generated in the test.
2418
- ///
2419
- /// This allows for doing so, validating proofs as normal, but, if they pass, replacing the
2420
- /// offer they resolve to to the given one.
2421
- pub testing_dnssec_proof_offer_resolution_override: Mutex<HashMap<HumanReadableName, Offer>>,
2422
-
2423
2412
#[cfg(test)]
2424
2413
pub(super) entropy_source: ES,
2425
2414
#[cfg(not(test))]
@@ -3351,9 +3340,6 @@ where
3351
3340
hrn_resolver: OMNameResolver::new(current_timestamp, params.best_block.height),
3352
3341
#[cfg(feature = "dnssec")]
3353
3342
pending_dns_onion_messages: Mutex::new(Vec::new()),
3354
-
3355
- #[cfg(feature = "_test_utils")]
3356
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
3357
3343
}
3358
3344
}
3359
3345
@@ -9820,6 +9806,18 @@ where
9820
9806
9821
9807
self.enqueue_invoice_request(invoice_request, reply_paths)
9822
9808
}
9809
+
9810
+ #[cfg(feature = "dnssec")]
9811
+ fn amt_msats_for_payment_awaiting_offer(&self, payment_id: PaymentId) -> Result<u64, ()> {
9812
+ self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id)
9813
+ }
9814
+
9815
+ #[cfg(feature = "dnssec")]
9816
+ fn received_offer(
9817
+ &self, payment_id: PaymentId, retryable_invoice_request: Option<RetryableInvoiceRequest>,
9818
+ ) -> Result<(), ()> {
9819
+ self.pending_outbound_payments.received_offer(payment_id, retryable_invoice_request)
9820
+ }
9823
9821
}
9824
9822
9825
9823
/// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
@@ -11375,69 +11373,6 @@ where
11375
11373
}
11376
11374
}
11377
11375
11378
- #[cfg(feature = "dnssec")]
11379
- impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11380
- DNSResolverMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11381
- where
11382
- M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
11383
- T::Target: BroadcasterInterface,
11384
- ES::Target: EntropySource,
11385
- NS::Target: NodeSigner,
11386
- SP::Target: SignerProvider,
11387
- F::Target: FeeEstimator,
11388
- R::Target: Router,
11389
- MR::Target: MessageRouter,
11390
- L::Target: Logger,
11391
- {
11392
- fn handle_dnssec_query(
11393
- &self, _message: DNSSECQuery, _responder: Option<Responder>,
11394
- ) -> Option<(DNSResolverMessage, ResponseInstruction)> {
11395
- None
11396
- }
11397
-
11398
- fn handle_dnssec_proof(&self, message: DNSSECProof, context: DNSResolverContext) {
11399
- let offer_opt = self.hrn_resolver.handle_dnssec_proof_for_offer(message, context);
11400
- #[cfg_attr(not(feature = "_test_utils"), allow(unused_mut))]
11401
- if let Some((completed_requests, mut offer)) = offer_opt {
11402
- for (name, payment_id) in completed_requests {
11403
- #[cfg(feature = "_test_utils")]
11404
- if let Some(replacement_offer) = self.testing_dnssec_proof_offer_resolution_override.lock().unwrap().remove(&name) {
11405
- // If we have multiple pending requests we may end up over-using the override
11406
- // offer, but tests can deal with that.
11407
- offer = replacement_offer;
11408
- }
11409
- if let Ok(amt_msats) = self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id) {
11410
- let offer_pay_res =
11411
- self.pay_for_offer_intern(&offer, None, Some(amt_msats), None, payment_id, Some(name),
11412
- |invoice_request, nonce| {
11413
- let retryable_invoice_request = RetryableInvoiceRequest {
11414
- invoice_request: invoice_request.clone(),
11415
- nonce,
11416
- };
11417
- self.pending_outbound_payments
11418
- .received_offer(payment_id, Some(retryable_invoice_request))
11419
- .map_err(|_| Bolt12SemanticError::DuplicatePaymentId)
11420
- });
11421
- if offer_pay_res.is_err() {
11422
- // The offer we tried to pay is the canonical current offer for the name we
11423
- // wanted to pay. If we can't pay it, there's no way to recover so fail the
11424
- // payment.
11425
- // Note that the PaymentFailureReason should be ignored for an
11426
- // AwaitingInvoice payment.
11427
- self.pending_outbound_payments.abandon_payment(
11428
- payment_id, PaymentFailureReason::RouteNotFound, &self.pending_events,
11429
- );
11430
- }
11431
- }
11432
- }
11433
- }
11434
- }
11435
-
11436
- fn release_pending_messages(&self) -> Vec<(DNSResolverMessage, MessageSendInstructions)> {
11437
- core::mem::take(&mut self.pending_dns_onion_messages.lock().unwrap())
11438
- }
11439
- }
11440
-
11441
11376
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11442
11377
NodeIdLookUp for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11443
11378
where
@@ -13318,9 +13253,6 @@ where
13318
13253
hrn_resolver: OMNameResolver::new(highest_seen_timestamp, best_block_height),
13319
13254
#[cfg(feature = "dnssec")]
13320
13255
pending_dns_onion_messages: Mutex::new(Vec::new()),
13321
-
13322
- #[cfg(feature = "_test_utils")]
13323
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
13324
13256
};
13325
13257
13326
13258
for (_, monitor) in args.channel_monitors.iter() {
0 commit comments