@@ -40,7 +40,6 @@ use crate::onion_message::messenger::{
40
40
Destination , MessageRouter , MessageSendInstructions , Responder , ResponseInstruction ,
41
41
} ;
42
42
use crate :: onion_message:: offers:: { OffersMessage , OffersMessageHandler } ;
43
- use crate :: sync:: MutexGuard ;
44
43
45
44
use crate :: offers:: invoice_error:: InvoiceError ;
46
45
use crate :: offers:: nonce:: Nonce ;
75
74
///
76
75
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
77
76
pub trait OffersMessageCommons {
78
- #[ cfg( feature = "dnssec" ) ]
79
- /// Get pending DNS onion messages
80
- fn get_pending_dns_onion_messages (
81
- & self ,
82
- ) -> MutexGuard < ' _ , Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ;
83
-
84
77
#[ cfg( feature = "dnssec" ) ]
85
78
/// Get hrn resolver
86
79
fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -565,6 +558,9 @@ where
565
558
#[ cfg( any( test, feature = "_test_utils" ) ) ]
566
559
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
567
560
561
+ #[ cfg( feature = "dnssec" ) ]
562
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
563
+
568
564
#[ cfg( feature = "_test_utils" ) ]
569
565
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
570
566
/// offer generated in the test.
@@ -604,6 +600,10 @@ where
604
600
message_router,
605
601
606
602
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
603
+
604
+ #[ cfg( feature = "dnssec" ) ]
605
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
606
+
607
607
#[ cfg( feature = "_test_utils" ) ]
608
608
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
609
609
logger,
@@ -1547,7 +1547,7 @@ where
1547
1547
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1548
1548
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1549
1549
for ( reply_path, destination) in message_params {
1550
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1550
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1551
1551
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1552
1552
MessageSendInstructions :: WithSpecifiedReplyPath {
1553
1553
destination : destination. clone ( ) ,
@@ -1627,6 +1627,6 @@ where
1627
1627
}
1628
1628
1629
1629
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1630
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1630
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1631
1631
}
1632
1632
}
0 commit comments