@@ -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 ;
@@ -578,6 +571,9 @@ where
578
571
#[ cfg( any( test, feature = "_test_utils" ) ) ]
579
572
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
580
573
574
+ #[ cfg( feature = "dnssec" ) ]
575
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
576
+
581
577
#[ cfg( feature = "_test_utils" ) ]
582
578
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
583
579
/// offer generated in the test.
@@ -617,6 +613,10 @@ where
617
613
message_router,
618
614
619
615
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
616
+
617
+ #[ cfg( feature = "dnssec" ) ]
618
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
619
+
620
620
#[ cfg( feature = "_test_utils" ) ]
621
621
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
622
622
logger,
@@ -1528,7 +1528,7 @@ where
1528
1528
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1529
1529
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1530
1530
for ( reply_path, destination) in message_params {
1531
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1531
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1532
1532
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1533
1533
MessageSendInstructions :: WithSpecifiedReplyPath {
1534
1534
destination : destination. clone ( ) ,
@@ -1608,6 +1608,6 @@ where
1608
1608
}
1609
1609
1610
1610
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1611
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1611
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1612
1612
}
1613
1613
}
0 commit comments