@@ -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 ;
8483///
8584/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8685pub trait OffersMessageCommons {
87- #[ cfg( feature = "dnssec" ) ]
88- /// Get pending DNS onion messages
89- fn get_pending_dns_onion_messages (
90- & self ,
91- ) -> MutexGuard < ' _ , Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ;
92-
9386 #[ cfg( feature = "dnssec" ) ]
9487 /// Get hrn resolver
9588 fn get_hrn_resolver ( & self ) -> & OMNameResolver ;
@@ -575,6 +568,9 @@ where
575568 #[ cfg( any( test, feature = "_test_utils" ) ) ]
576569 pub ( crate ) pending_offers_messages : Mutex < Vec < ( OffersMessage , MessageSendInstructions ) > > ,
577570
571+ #[ cfg( feature = "dnssec" ) ]
572+ pending_dns_onion_messages : Mutex < Vec < ( DNSResolverMessage , MessageSendInstructions ) > > ,
573+
578574 #[ cfg( feature = "_test_utils" ) ]
579575 /// In testing, it is useful be able to forge a name -> offer mapping so that we can pay an
580576 /// offer generated in the test.
@@ -614,6 +610,10 @@ where
614610 message_router,
615611
616612 pending_offers_messages : Mutex :: new ( Vec :: new ( ) ) ,
613+
614+ #[ cfg( feature = "dnssec" ) ]
615+ pending_dns_onion_messages : Mutex :: new ( Vec :: new ( ) ) ,
616+
617617 #[ cfg( feature = "_test_utils" ) ]
618618 testing_dnssec_proof_offer_resolution_override : Mutex :: new ( new_hash_map ( ) ) ,
619619 logger,
@@ -1661,7 +1661,7 @@ where
16611661 . flat_map ( |destination| reply_paths. iter ( ) . map ( move |path| ( path, destination) ) )
16621662 . take ( OFFERS_MESSAGE_REQUEST_LIMIT ) ;
16631663 for ( reply_path, destination) in message_params {
1664- self . commons . get_pending_dns_onion_messages ( ) . push ( (
1664+ self . pending_dns_onion_messages . lock ( ) . unwrap ( ) . push ( (
16651665 DNSResolverMessage :: DNSSECQuery ( onion_message. clone ( ) ) ,
16661666 MessageSendInstructions :: WithSpecifiedReplyPath {
16671667 destination : destination. clone ( ) ,
@@ -1742,6 +1742,6 @@ where
17421742 }
17431743
17441744 fn release_pending_messages ( & self ) -> Vec < ( DNSResolverMessage , MessageSendInstructions ) > {
1745- core:: mem:: take ( & mut self . commons . get_pending_dns_onion_messages ( ) )
1745+ core:: mem:: take ( & mut self . pending_dns_onion_messages . lock ( ) . unwrap ( ) )
17461746 }
17471747}
0 commit comments