From 2bbb3b708311ced636466943ceb66a97da6a4f98 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 14 Jul 2024 01:17:03 +0000 Subject: [PATCH] Use `ChannelManager` as `DNSResolverMessageHandler` by default Now that `ChannelManager` supports using bLIP 32 to resolve BIP 353 Human Readable Names we should encourage users to use that feature by making the "default" (in various type aliases) to use `ChannelManager` as the `DNSResolverMessageHandler`. --- lightning/src/ln/functional_test_utils.rs | 23 ++++++++++- lightning/src/onion_message/messenger.rs | 50 ++++++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 9d6da1c8f..a6e07a8bc 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -408,6 +408,7 @@ type TestChannelManager<'node_cfg, 'chan_mon_cfg> = ChannelManager< &'chan_mon_cfg test_utils::TestLogger, >; +#[cfg(not(feature = "dnssec"))] type TestOnionMessenger<'chan_man, 'node_cfg, 'chan_mon_cfg> = OnionMessenger< DedicatedEntropy, &'node_cfg test_utils::TestKeysInterface, @@ -416,7 +417,20 @@ type TestOnionMessenger<'chan_man, 'node_cfg, 'chan_mon_cfg> = OnionMessenger< &'node_cfg test_utils::TestMessageRouter<'chan_mon_cfg>, &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, - IgnoringMessageHandler, // TODO: Swap for ChannelManager (when built with the "dnssec" feature) + IgnoringMessageHandler, + IgnoringMessageHandler, +>; + +#[cfg(feature = "dnssec")] +type TestOnionMessenger<'chan_man, 'node_cfg, 'chan_mon_cfg> = OnionMessenger< + DedicatedEntropy, + &'node_cfg test_utils::TestKeysInterface, + &'chan_mon_cfg test_utils::TestLogger, + &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, + &'node_cfg test_utils::TestMessageRouter<'chan_mon_cfg>, + &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, + &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, + &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, IgnoringMessageHandler, >; @@ -3294,6 +3308,13 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec = OnionMessenger< Arc, Arc, @@ -1844,7 +1845,51 @@ pub type SimpleArcOnionMessenger = OnionMessenger< Arc>>, Arc, Arc>>, Arc>, Arc>, - IgnoringMessageHandler, // TODO: Swap for ChannelManager (when built with the "dnssec" feature) + Arc>, + IgnoringMessageHandler +>; + +/// Useful for simplifying the parameters of [`SimpleArcChannelManager`] and +/// [`SimpleArcPeerManager`]. See their docs for more details. +/// +/// This is not exported to bindings users as type aliases aren't supported in most languages. +/// +/// [`SimpleArcChannelManager`]: crate::ln::channelmanager::SimpleArcChannelManager +/// [`SimpleArcPeerManager`]: crate::ln::peer_handler::SimpleArcPeerManager +#[cfg(not(c_bindings))] +#[cfg(not(feature = "dnssec"))] +pub type SimpleArcOnionMessenger = OnionMessenger< + Arc, + Arc, + Arc, + Arc>, + Arc>>, Arc, Arc>>, + Arc>, + Arc>, + IgnoringMessageHandler, + IgnoringMessageHandler +>; + +/// Useful for simplifying the parameters of [`SimpleRefChannelManager`] and +/// [`SimpleRefPeerManager`]. See their docs for more details. +/// +/// This is not exported to bindings users as type aliases aren't supported in most languages. +/// +/// [`SimpleRefChannelManager`]: crate::ln::channelmanager::SimpleRefChannelManager +/// [`SimpleRefPeerManager`]: crate::ln::peer_handler::SimpleRefPeerManager +#[cfg(not(c_bindings))] +#[cfg(feature = "dnssec")] +pub type SimpleRefOnionMessenger< + 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, M, T, F, L +> = OnionMessenger< + &'a KeysManager, + &'a KeysManager, + &'b L, + &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, + &'i DefaultMessageRouter<&'g NetworkGraph<&'b L>, &'b L, &'a KeysManager>, + &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, + &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, + &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, IgnoringMessageHandler >; @@ -1856,6 +1901,7 @@ pub type SimpleArcOnionMessenger = OnionMessenger< /// [`SimpleRefChannelManager`]: crate::ln::channelmanager::SimpleRefChannelManager /// [`SimpleRefPeerManager`]: crate::ln::peer_handler::SimpleRefPeerManager #[cfg(not(c_bindings))] +#[cfg(not(feature = "dnssec"))] pub type SimpleRefOnionMessenger< 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, M, T, F, L > = OnionMessenger< @@ -1866,7 +1912,7 @@ pub type SimpleRefOnionMessenger< &'i DefaultMessageRouter<&'g NetworkGraph<&'b L>, &'b L, &'a KeysManager>, &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L>, - IgnoringMessageHandler, // TODO: Swap for ChannelManager (when built with the "dnssec" feature) + IgnoringMessageHandler, IgnoringMessageHandler >; -- 2.39.5