@@ -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 ;
69
68
///
70
69
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
71
70
pub trait OffersMessageCommons {
72
- #[ cfg( feature = "dnssec" ) ]
73
- /// Get pending DNS onion messages
74
- fn get_pending_dns_onion_messages (
75
- & self ,
76
- ) -> MutexGuard < ' _ , Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ;
77
-
78
71
#[ cfg( feature = "dnssec" ) ]
79
72
/// Get hrn resolver
80
73
fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -562,6 +555,9 @@ where
562
555
#[ cfg( any( test, feature = "_test_utils" ) ) ]
563
556
pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
564
557
558
+ #[ cfg( feature = "dnssec" ) ]
559
+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
560
+
565
561
#[ cfg( feature = "_test_utils" ) ]
566
562
/// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
567
563
/// offer generated in the test.
@@ -601,6 +597,10 @@ where
601
597
message_router,
602
598
603
599
pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
600
+
601
+ #[ cfg( feature = "dnssec" ) ]
602
+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
603
+
604
604
#[ cfg( feature = "_test_utils" ) ]
605
605
testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
606
606
logger,
@@ -1515,7 +1515,7 @@ where
1515
1515
. flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
1516
1516
. take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
1517
1517
for ( reply_path, destination) in message_params {
1518
- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1518
+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
1519
1519
DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
1520
1520
MessageSendInstructions :: WithSpecifiedReplyPath {
1521
1521
destination : destination. clone ( ) ,
@@ -1595,6 +1595,6 @@ where
1595
1595
}
1596
1596
1597
1597
fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1598
- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1598
+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
1599
1599
}
1600
1600
}
0 commit comments