@@ -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},
@@ -2392,14 +2389,6 @@ where
2392
2389
#[cfg(feature = "dnssec")]
2393
2390
pending_dns_onion_messages: Mutex<Vec<(DNSResolverMessage, MessageSendInstructions)>>,
2394
2391
2395
- #[cfg(feature = "_test_utils")]
2396
- /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
2397
- /// offer generated in the test.
2398
- ///
2399
- /// This allows for doing so, validating proofs as normal, but, if they pass, replacing the
2400
- /// offer they resolve to to the given one.
2401
- pub testing_dnssec_proof_offer_resolution_override: Mutex<HashMap<HumanReadableName, Offer>>,
2402
-
2403
2392
#[cfg(test)]
2404
2393
pub(super) entropy_source: ES,
2405
2394
#[cfg(not(test))]
@@ -3273,9 +3262,6 @@ where
3273
3262
hrn_resolver: OMNameResolver::new(current_timestamp, params.best_block.height),
3274
3263
#[cfg(feature = "dnssec")]
3275
3264
pending_dns_onion_messages: Mutex::new(Vec::new()),
3276
-
3277
- #[cfg(feature = "_test_utils")]
3278
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
3279
3265
}
3280
3266
}
3281
3267
@@ -9742,6 +9728,18 @@ where
9742
9728
9743
9729
self.enqueue_invoice_request(invoice_request, reply_paths)
9744
9730
}
9731
+
9732
+ #[cfg(feature = "dnssec")]
9733
+ fn amt_msats_for_payment_awaiting_offer(&self, payment_id: PaymentId) -> Result<u64, ()> {
9734
+ self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id)
9735
+ }
9736
+
9737
+ #[cfg(feature = "dnssec")]
9738
+ fn received_offer(
9739
+ &self, payment_id: PaymentId, retryable_invoice_request: Option<RetryableInvoiceRequest>,
9740
+ ) -> Result<(), ()> {
9741
+ self.pending_outbound_payments.received_offer(payment_id, retryable_invoice_request)
9742
+ }
9745
9743
}
9746
9744
9747
9745
/// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
@@ -11293,69 +11291,6 @@ where
11293
11291
}
11294
11292
}
11295
11293
11296
- #[cfg(feature = "dnssec")]
11297
- impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11298
- DNSResolverMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11299
- where
11300
- M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
11301
- T::Target: BroadcasterInterface,
11302
- ES::Target: EntropySource,
11303
- NS::Target: NodeSigner,
11304
- SP::Target: SignerProvider,
11305
- F::Target: FeeEstimator,
11306
- R::Target: Router,
11307
- MR::Target: MessageRouter,
11308
- L::Target: Logger,
11309
- {
11310
- fn handle_dnssec_query(
11311
- &self, _message: DNSSECQuery, _responder: Option<Responder>,
11312
- ) -> Option<(DNSResolverMessage, ResponseInstruction)> {
11313
- None
11314
- }
11315
-
11316
- fn handle_dnssec_proof(&self, message: DNSSECProof, context: DNSResolverContext) {
11317
- let offer_opt = self.hrn_resolver.handle_dnssec_proof_for_offer(message, context);
11318
- #[cfg_attr(not(feature = "_test_utils"), allow(unused_mut))]
11319
- if let Some((completed_requests, mut offer)) = offer_opt {
11320
- for (name, payment_id) in completed_requests {
11321
- #[cfg(feature = "_test_utils")]
11322
- if let Some(replacement_offer) = self.testing_dnssec_proof_offer_resolution_override.lock().unwrap().remove(&name) {
11323
- // If we have multiple pending requests we may end up over-using the override
11324
- // offer, but tests can deal with that.
11325
- offer = replacement_offer;
11326
- }
11327
- if let Ok(amt_msats) = self.pending_outbound_payments.amt_msats_for_payment_awaiting_offer(payment_id) {
11328
- let offer_pay_res =
11329
- self.pay_for_offer_intern(&offer, None, Some(amt_msats), None, payment_id, Some(name),
11330
- |invoice_request, nonce| {
11331
- let retryable_invoice_request = RetryableInvoiceRequest {
11332
- invoice_request: invoice_request.clone(),
11333
- nonce,
11334
- };
11335
- self.pending_outbound_payments
11336
- .received_offer(payment_id, Some(retryable_invoice_request))
11337
- .map_err(|_| Bolt12SemanticError::DuplicatePaymentId)
11338
- });
11339
- if offer_pay_res.is_err() {
11340
- // The offer we tried to pay is the canonical current offer for the name we
11341
- // wanted to pay. If we can't pay it, there's no way to recover so fail the
11342
- // payment.
11343
- // Note that the PaymentFailureReason should be ignored for an
11344
- // AwaitingInvoice payment.
11345
- self.pending_outbound_payments.abandon_payment(
11346
- payment_id, PaymentFailureReason::RouteNotFound, &self.pending_events,
11347
- );
11348
- }
11349
- }
11350
- }
11351
- }
11352
- }
11353
-
11354
- fn release_pending_messages(&self) -> Vec<(DNSResolverMessage, MessageSendInstructions)> {
11355
- core::mem::take(&mut self.pending_dns_onion_messages.lock().unwrap())
11356
- }
11357
- }
11358
-
11359
11294
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>
11360
11295
NodeIdLookUp for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
11361
11296
where
@@ -13208,9 +13143,6 @@ where
13208
13143
hrn_resolver: OMNameResolver::new(highest_seen_timestamp, best_block_height),
13209
13144
#[cfg(feature = "dnssec")]
13210
13145
pending_dns_onion_messages: Mutex::new(Vec::new()),
13211
-
13212
- #[cfg(feature = "_test_utils")]
13213
- testing_dnssec_proof_offer_resolution_override: Mutex::new(new_hash_map()),
13214
13146
};
13215
13147
13216
13148
for (_, monitor) in args.channel_monitors.iter() {
0 commit comments