@@ -42,7 +42,6 @@ use crate::onion_message::messenger::{
4242 Destination , MessageRouter , MessageSendInstructions , Responder , ResponseInstruction ,
4343} ;
4444use crate :: onion_message:: offers:: { OffersMessage , OffersMessageHandler } ;
45- use crate :: sync:: MutexGuard ;
4645
4746use crate :: offers:: invoice_error:: InvoiceError ;
4847use crate :: offers:: nonce:: Nonce ;
7170///
7271/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7372pub 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-
8073 #[ cfg( feature = "dnssec" ) ]
8174 /// Get hrn resolver
8275 fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -568,6 +561,9 @@ where
568561 #[ cfg( any( test, feature = "_test_utils" ) ) ]
569562 pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
570563
564+ #[ cfg( feature = "dnssec" ) ]
565+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
566+
571567 #[ cfg( feature = "_test_utils" ) ]
572568 /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
573569 /// offer generated in the test.
@@ -607,6 +603,10 @@ where
607603 message_router,
608604
609605 pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
606+
607+ #[ cfg( feature = "dnssec" ) ]
608+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
609+
610610 #[ cfg( feature = "_test_utils" ) ]
611611 testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
612612 logger,
@@ -1521,7 +1521,7 @@ where
15211521 . flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
15221522 . take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
15231523 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 ( (
15251525 DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
15261526 MessageSendInstructions :: WithSpecifiedReplyPath {
15271527 destination : destination. clone ( ) ,
@@ -1601,6 +1601,6 @@ where
16011601 }
16021602
16031603 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 ( ) )
16051605 }
16061606}
0 commit comments