@@ -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 ;
7574///
7675/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7776pub 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-
8477 #[ cfg( feature = "dnssec" ) ]
8578 /// Get hrn resolver
8679 fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -565,6 +558,9 @@ where
565558 #[ cfg( any( test, feature = "_test_utils" ) ) ]
566559 pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
567560
561+ #[ cfg( feature = "dnssec" ) ]
562+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
563+
568564 #[ cfg( feature = "_test_utils" ) ]
569565 /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
570566 /// offer generated in the test.
@@ -604,6 +600,10 @@ where
604600 message_router,
605601
606602 pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
603+
604+ #[ cfg( feature = "dnssec" ) ]
605+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
606+
607607 #[ cfg( feature = "_test_utils" ) ]
608608 testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
609609 logger,
@@ -1547,7 +1547,7 @@ where
15471547 . flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
15481548 . take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
15491549 for ( reply_path, destination) in message_params {
1550- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1550+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
15511551 DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
15521552 MessageSendInstructions :: WithSpecifiedReplyPath {
15531553 destination : destination. clone ( ) ,
@@ -1627,6 +1627,6 @@ where
16271627 }
16281628
16291629 fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1630- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1630+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
16311631 }
16321632}
0 commit comments