@@ -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 ;
84
83
///
85
84
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
86
85
pub trait OffersMessageCommons {
87
- #[ cfg( feature = "dnssec" ) ]
88
- /// Get pending DNS onion messages
89
- fn get_pending_dns_onion_messages (
90
- & self ,
91
- ) -> MutexGuard < ' _ , Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ;
92
-
93
86
#[ cfg( feature = "dnssec" ) ]
94
87
/// Get hrn resolver
95
88
fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -575,6 +568,9 @@ where
575
568
#[ cfg( any( test, feature = "_test_utils" ) ) ]
576
569
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
577
570
571
+ #[ cfg( feature = "dnssec" ) ]
572
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
573
+
578
574
#[ cfg( feature = "_test_utils" ) ]
579
575
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
580
576
/// offer generated in the test.
@@ -614,6 +610,10 @@ where
614
610
message_router,
615
611
616
612
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
613
+
614
+ #[ cfg( feature = "dnssec" ) ]
615
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
616
+
617
617
#[ cfg( feature = "_test_utils" ) ]
618
618
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
619
619
logger,
@@ -1661,7 +1661,7 @@ where
1661
1661
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1662
1662
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1663
1663
for ( reply_path, destination) in message_params {
1664
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1664
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1665
1665
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1666
1666
MessageSendInstructions :: WithSpecifiedReplyPath {
1667
1667
destination : destination. clone ( ) ,
@@ -1742,6 +1742,6 @@ where
1742
1742
}
1743
1743
1744
1744
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1745
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1745
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1746
1746
}
1747
1747
}
0 commit comments