@@ -40,7 +40,6 @@ use crate::onion_message::messenger::{
4040 Destination , MessageRouter , MessageSendInstructions , Responder , ResponseInstruction ,
4141} ;
4242use crate :: onion_message:: offers:: { OffersMessage , OffersMessageHandler } ;
43- use crate :: sync:: MutexGuard ;
4443
4544use crate :: offers:: invoice_error:: InvoiceError ;
4645use crate :: offers:: nonce:: Nonce ;
6968///
7069/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7170pub 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-
7871 #[ cfg( feature = "dnssec" ) ]
7972 /// Get hrn resolver
8073 fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -562,6 +555,9 @@ where
562555 #[ cfg( any( test, feature = "_test_utils" ) ) ]
563556 pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
564557
558+ #[ cfg( feature = "dnssec" ) ]
559+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
560+
565561 #[ cfg( feature = "_test_utils" ) ]
566562 /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
567563 /// offer generated in the test.
@@ -601,6 +597,10 @@ where
601597 message_router,
602598
603599 pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
600+
601+ #[ cfg( feature = "dnssec" ) ]
602+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
603+
604604 #[ cfg( feature = "_test_utils" ) ]
605605 testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
606606 logger,
@@ -1515,7 +1515,7 @@ where
15151515 . flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
15161516 . take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
15171517 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 ( (
15191519 DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
15201520 MessageSendInstructions :: WithSpecifiedReplyPath {
15211521 destination : destination. clone ( ) ,
@@ -1595,6 +1595,6 @@ where
15951595 }
15961596
15971597 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 ( ) )
15991599 }
16001600}
0 commit comments