@@ -42,7 +42,6 @@ use crate::onion_message::messenger::{
42
42
Destination , MessageRouter , MessageSendInstructions , Responder , ResponseInstruction ,
43
43
} ;
44
44
use crate :: onion_message:: offers:: { OffersMessage , OffersMessageHandler } ;
45
- use crate :: sync:: MutexGuard ;
46
45
47
46
use crate :: offers:: invoice_error:: InvoiceError ;
48
47
use crate :: offers:: nonce:: Nonce ;
71
70
///
72
71
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
73
72
pub trait OffersMessageCommons {
74
- #[ cfg( feature = "dnssec" ) ]
75
- /// Get pending DNS onion messages
76
- fn get_pending_dns_onion_messages (
77
- & self ,
78
- ) -> MutexGuard < ' _ , Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ;
79
-
80
73
#[ cfg( feature = "dnssec" ) ]
81
74
/// Get hrn resolver
82
75
fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -568,6 +561,9 @@ where
568
561
#[ cfg( any( test, feature = "_test_utils" ) ) ]
569
562
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
570
563
564
+ #[ cfg( feature = "dnssec" ) ]
565
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
566
+
571
567
#[ cfg( feature = "_test_utils" ) ]
572
568
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
573
569
/// offer generated in the test.
@@ -607,6 +603,10 @@ where
607
603
message_router,
608
604
609
605
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
606
+
607
+ #[ cfg( feature = "dnssec" ) ]
608
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
609
+
610
610
#[ cfg( feature = "_test_utils" ) ]
611
611
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
612
612
logger,
@@ -1521,7 +1521,7 @@ where
1521
1521
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1522
1522
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1523
1523
for ( reply_path, destination) in message_params {
1524
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1524
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1525
1525
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1526
1526
MessageSendInstructions :: WithSpecifiedReplyPath {
1527
1527
destination : destination. clone ( ) ,
@@ -1601,6 +1601,6 @@ where
1601
1601
}
1602
1602
1603
1603
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1604
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1604
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1605
1605
}
1606
1606
}
0 commit comments