@@ -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 ;
@@ -570,6 +563,9 @@ where
570563 #[ cfg( any( test, feature = "_test_utils" ) ) ]
571564 pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
572565
566+ #[ cfg( feature = "dnssec" ) ]
567+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
568+
573569 #[ cfg( feature = "_test_utils" ) ]
574570 /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
575571 /// offer generated in the test.
@@ -609,6 +605,10 @@ where
609605 message_router,
610606
611607 pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
608+
609+ #[ cfg( feature = "dnssec" ) ]
610+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
611+
612612 #[ cfg( feature = "_test_utils" ) ]
613613 testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
614614 logger,
@@ -1536,7 +1536,7 @@ where
15361536 . flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
15371537 . take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
15381538 for ( reply_path, destination) in message_params {
1539- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1539+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
15401540 DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
15411541 MessageSendInstructions :: WithSpecifiedReplyPath {
15421542 destination : destination. clone ( ) ,
@@ -1616,6 +1616,6 @@ where
16161616 }
16171617
16181618 fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1619- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1619+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
16201620 }
16211621}
0 commit comments