@@ -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 ;
@@ -570,6 +563,9 @@ where
570
563
#[ cfg( any( test, feature = "_test_utils" ) ) ]
571
564
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
572
565
566
+ #[ cfg( feature = "dnssec" ) ]
567
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
568
+
573
569
#[ cfg( feature = "_test_utils" ) ]
574
570
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
575
571
/// offer generated in the test.
@@ -609,6 +605,10 @@ where
609
605
message_router,
610
606
611
607
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
608
+
609
+ #[ cfg( feature = "dnssec" ) ]
610
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
611
+
612
612
#[ cfg( feature = "_test_utils" ) ]
613
613
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
614
614
logger,
@@ -1536,7 +1536,7 @@ where
1536
1536
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1537
1537
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1538
1538
for ( reply_path, destination) in message_params {
1539
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1539
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1540
1540
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1541
1541
MessageSendInstructions :: WithSpecifiedReplyPath {
1542
1542
destination : destination. clone ( ) ,
@@ -1616,6 +1616,6 @@ where
1616
1616
}
1617
1617
1618
1618
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1619
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1619
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1620
1620
}
1621
1621
}
0 commit comments