From: Jeffrey Czyz Date: Wed, 18 Sep 2024 16:52:38 +0000 (-0500) Subject: Parameterize ChannelManager with MessageRouter X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=04c51b380dbd9f55d5fb2a87f9d3c9f75f98777a;p=rust-lightning Parameterize ChannelManager with MessageRouter ChannelManager is parameterized by a Router, which must also implement MessageRouter. Instead, add a MessageRouter parameter such that the Router and MessageRouter traits can be de-coupled. This simplifies using something other than DefaultMessageRouter, which DefaultRouter currently delegates to. --- diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 1605af69a..9616b6f54 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -503,6 +503,7 @@ type ChanMan<'a> = ChannelManager< Arc, Arc, &'a FuzzRouter, + &'a FuzzRouter, Arc, >; @@ -709,6 +710,7 @@ pub fn do_test(data: &[u8], underlying_out: Out, anchors: bool) { monitor.clone(), broadcast.clone(), &router, + &router, Arc::clone(&logger), keys_manager.clone(), keys_manager.clone(), @@ -777,6 +779,7 @@ pub fn do_test(data: &[u8], underlying_out: Out, anchors: bool) { chain_monitor: chain_monitor.clone(), tx_broadcaster: broadcast.clone(), router: &router, + message_router: &router, logger, default_config: config, channel_monitors: monitor_refs, diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 90449248e..810e74ad8 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -236,6 +236,7 @@ type ChannelMan<'a> = ChannelManager< Arc, Arc, &'a FuzzRouter, + &'a FuzzRouter, Arc, >; type PeerMan<'a> = PeerManager< @@ -653,6 +654,7 @@ pub fn do_test(mut data: &[u8], logger: &Arc) { monitor.clone(), broadcast.clone(), &router, + &router, Arc::clone(&logger), keys_manager.clone(), keys_manager.clone(), diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 59b68dbfb..fdeb46229 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -1154,6 +1154,13 @@ mod tests { TestScorer, >, >, + Arc< + DefaultMessageRouter< + Arc>>, + Arc, + Arc, + >, + >, Arc, >; @@ -1579,6 +1586,7 @@ mod tests { chain_monitor.clone(), tx_broadcaster.clone(), router.clone(), + msg_router.clone(), logger.clone(), keys_manager.clone(), keys_manager.clone(), diff --git a/lightning-block-sync/src/init.rs b/lightning-block-sync/src/init.rs index e01afb56e..ae69518ce 100644 --- a/lightning-block-sync/src/init.rs +++ b/lightning-block-sync/src/init.rs @@ -50,6 +50,7 @@ where /// use lightning::chain::chaininterface::BroadcasterInterface; /// use lightning::chain::chaininterface::FeeEstimator; /// use lightning::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs}; +/// use lightning::onion_message::messenger::MessageRouter; /// use lightning::routing::router::Router; /// use lightning::sign; /// use lightning::sign::{EntropySource, NodeSigner, SignerProvider}; @@ -69,6 +70,7 @@ where /// T: BroadcasterInterface, /// F: FeeEstimator, /// R: Router, +/// MR: MessageRouter, /// L: Logger, /// C: chain::Filter, /// P: chainmonitor::Persist, @@ -82,6 +84,7 @@ where /// tx_broadcaster: &T, /// fee_estimator: &F, /// router: &R, +/// message_router: &MR, /// logger: &L, /// persister: &P, /// ) { @@ -101,11 +104,12 @@ where /// chain_monitor, /// tx_broadcaster, /// router, +/// message_router, /// logger, /// config, /// vec![&mut monitor], /// ); -/// <(BlockHash, ChannelManager<&ChainMonitor, &T, &ES, &NS, &SP, &F, &R, &L>)>::read( +/// <(BlockHash, ChannelManager<&ChainMonitor, &T, &ES, &NS, &SP, &F, &R, &MR, &L>)>::read( /// &mut Cursor::new(&serialized_manager), read_args).unwrap() /// }; /// diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 2cfa60ea7..b5352e853 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -89,6 +89,7 @@ use crate::util::errors::APIError; #[cfg(not(c_bindings))] use { crate::offers::offer::DerivedMetadata, + crate::onion_message::messenger::DefaultMessageRouter, crate::routing::router::DefaultRouter, crate::routing::gossip::NetworkGraph, crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParameters}, @@ -1222,6 +1223,11 @@ pub type SimpleArcChannelManager = ChannelManager< ProbabilisticScoringFeeParameters, ProbabilisticScorer>>, Arc>, >>, + Arc>>, + Arc, + Arc, + >>, Arc >; @@ -1237,7 +1243,7 @@ pub type SimpleArcChannelManager = ChannelManager< /// /// This is not exported to bindings users as type aliases aren't supported in most languages. #[cfg(not(c_bindings))] -pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L> = +pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, M, T, F, L> = ChannelManager< &'a M, &'b T, @@ -1253,6 +1259,11 @@ pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L> = ProbabilisticScoringFeeParameters, ProbabilisticScorer<&'f NetworkGraph<&'g L>, &'g L> >, + &'i DefaultMessageRouter< + &'f NetworkGraph<&'g L>, + &'g L, + &'c KeysManager, + >, &'g L >; @@ -1291,16 +1302,20 @@ pub trait AChannelManager { type Router: Router + ?Sized; /// A type that may be dereferenced to [`Self::Router`]. type R: Deref; + /// A type implementing [`MessageRouter`]. + type MessageRouter: MessageRouter + ?Sized; + /// A type that may be dereferenced to [`Self::MessageRouter`]. + type MR: Deref; /// A type implementing [`Logger`]. type Logger: Logger + ?Sized; /// A type that may be dereferenced to [`Self::Logger`]. type L: Deref; /// Returns a reference to the actual [`ChannelManager`] object. - fn get_cm(&self) -> &ChannelManager; + fn get_cm(&self) -> &ChannelManager; } -impl AChannelManager -for ChannelManager +impl AChannelManager +for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -1309,6 +1324,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { type Watch = M::Target; @@ -1326,9 +1342,11 @@ where type F = F; type Router = R::Target; type R = R; + type MessageRouter = MR::Target; + type MR = MR; type Logger = L::Target; type L = L; - fn get_cm(&self) -> &ChannelManager { self } + fn get_cm(&self) -> &ChannelManager { self } } /// A lightning node's channel state machine and payment management logic, which facilitates @@ -1345,6 +1363,7 @@ where /// - [`FeeEstimator`] to determine transaction fee rates needed to have a transaction mined in a /// timely manner /// - [`Router`] for finding payment paths when initiating and retrying payments +/// - [`MessageRouter`] for finding message paths when initiating and retrying onion messages /// - [`Logger`] for logging operational information of varying degrees /// /// Additionally, it implements the following traits: @@ -1405,6 +1424,7 @@ where /// # chain_monitor: &dyn lightning::chain::Watch, /// # tx_broadcaster: &dyn lightning::chain::chaininterface::BroadcasterInterface, /// # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S, SP, SL>, +/// # message_router: &lightning::onion_message::messenger::DefaultMessageRouter<&NetworkGraph<&'a L>, &'a L, &ES>, /// # logger: &L, /// # entropy_source: &ES, /// # node_signer: &dyn lightning::sign::NodeSigner, @@ -1420,18 +1440,18 @@ where /// }; /// let default_config = UserConfig::default(); /// let channel_manager = ChannelManager::new( -/// fee_estimator, chain_monitor, tx_broadcaster, router, logger, entropy_source, node_signer, -/// signer_provider, default_config, params, current_timestamp +/// fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, +/// entropy_source, node_signer, signer_provider, default_config, params, current_timestamp, /// ); /// /// // Restart from deserialized data /// let mut channel_monitors = read_channel_monitors(); /// let args = ChannelManagerReadArgs::new( /// entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, -/// router, logger, default_config, channel_monitors.iter_mut().collect() +/// router, message_router, logger, default_config, channel_monitors.iter_mut().collect(), /// ); /// let (block_hash, channel_manager) = -/// <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; +/// <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; /// /// // Update the ChannelManager and ChannelMonitors with the latest chain data /// // ... @@ -2112,7 +2132,7 @@ where // | // |__`pending_background_events` // -pub struct ChannelManager +pub struct ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -2121,6 +2141,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { default_configuration: UserConfig, @@ -2130,6 +2151,7 @@ where tx_broadcaster: T, #[allow(unused)] router: R, + message_router: MR, /// See `ChannelManager` struct-level documentation for lock order requirements. #[cfg(test)] @@ -3088,7 +3110,7 @@ macro_rules! process_events_body { } } -impl ChannelManager +impl ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -3097,6 +3119,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// Constructs a new `ChannelManager` to hold several channels and route between them. @@ -3117,9 +3140,9 @@ where /// [`block_disconnected`]: chain::Listen::block_disconnected /// [`params.best_block.block_hash`]: chain::BestBlock::block_hash pub fn new( - fee_est: F, chain_monitor: M, tx_broadcaster: T, router: R, logger: L, entropy_source: ES, - node_signer: NS, signer_provider: SP, config: UserConfig, params: ChainParameters, - current_timestamp: u32, + fee_est: F, chain_monitor: M, tx_broadcaster: T, router: R, message_router: MR, logger: L, + entropy_source: ES, node_signer: NS, signer_provider: SP, config: UserConfig, + params: ChainParameters, current_timestamp: u32, ) -> Self { let mut secp_ctx = Secp256k1::new(); secp_ctx.seeded_randomize(&entropy_source.get_secure_random_bytes()); @@ -3132,6 +3155,7 @@ where chain_monitor, tx_broadcaster, router, + message_router, best_block: RwLock::new(params.best_block), @@ -9142,7 +9166,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => { /// even if multiple invoices are received. const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10; -impl ChannelManager +impl ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -9151,6 +9175,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { #[cfg(not(c_bindings))] @@ -9551,7 +9576,7 @@ where .map(|(node_id, _)| *node_id) .collect::>(); - self.router + self.message_router .create_blinded_paths(recipient, context, peers, secp_ctx) .and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(())) } @@ -9579,7 +9604,7 @@ where }) .collect::>(); - self.router + self.message_router .create_compact_blinded_paths(recipient, MessageContext::Offers(context), peers, secp_ctx) .and_then(|paths| (!paths.is_empty()).then(|| paths).ok_or(())) } @@ -9794,7 +9819,7 @@ where } } -impl MessageSendEventsProvider for ChannelManager +impl MessageSendEventsProvider for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -9803,6 +9828,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// Returns `MessageSendEvent`s strictly ordered per-peer, in the order they were generated. @@ -9866,7 +9892,7 @@ where } } -impl EventsProvider for ChannelManager +impl EventsProvider for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -9875,6 +9901,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// Processes events that must be periodically handled. @@ -9887,7 +9914,7 @@ where } } -impl chain::Listen for ChannelManager +impl chain::Listen for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -9896,6 +9923,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) { @@ -9929,7 +9957,7 @@ where } } -impl chain::Confirm for ChannelManager +impl chain::Confirm for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -9938,6 +9966,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData, height: u32) { @@ -10061,7 +10090,7 @@ where } } -impl ChannelManager +impl ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -10070,6 +10099,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// Calls a function which handles an on-chain event (blocks dis/connected, transactions @@ -10318,8 +10348,8 @@ where } } -impl - ChannelMessageHandler for ChannelManager +impl + ChannelMessageHandler for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -10328,6 +10358,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn handle_open_channel(&self, counterparty_node_id: PublicKey, msg: &msgs::OpenChannel) { @@ -10983,8 +11014,8 @@ where } } -impl -OffersMessageHandler for ChannelManager +impl +OffersMessageHandler for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -10993,6 +11024,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn handle_message( @@ -11214,8 +11246,8 @@ where } } -impl -AsyncPaymentsMessageHandler for ChannelManager +impl +AsyncPaymentsMessageHandler for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -11224,6 +11256,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn held_htlc_available( @@ -11249,8 +11282,8 @@ where } } -impl -NodeIdLookUp for ChannelManager +impl +NodeIdLookUp for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -11259,6 +11292,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn next_node_id(&self, short_channel_id: u64) -> Option { @@ -11697,7 +11731,7 @@ impl_writeable_tlv_based!(PendingInboundPayment, { (8, min_value_msat, required), }); -impl Writeable for ChannelManager +impl Writeable for ChannelManager where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -11706,6 +11740,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { fn write(&self, writer: &mut W) -> Result<(), io::Error> { @@ -12000,7 +12035,7 @@ impl Readable for VecDeque<(Event, Option)> { /// which you've already broadcasted the transaction. /// /// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor -pub struct ChannelManagerReadArgs<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref> +pub struct ChannelManagerReadArgs<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -12009,6 +12044,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// A cryptographically secure source of entropy. @@ -12042,6 +12078,9 @@ where /// /// No calls to the router will be made during deserialization. pub router: R, + /// The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, + /// [`Refund`]s, and any reply paths. + pub message_router: MR, /// The Logger for use in the ChannelManager and which may be used to log information during /// deserialization. pub logger: L, @@ -12064,8 +12103,8 @@ where pub channel_monitors: HashMap::EcdsaSigner>>, } -impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref> - ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L> +impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> + ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L> where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -12074,15 +12113,21 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { /// Simple utility function to create a ChannelManagerReadArgs which creates the monitor /// HashMap for you. This is primarily useful for C bindings where it is not practical to /// populate a HashMap directly from C. - pub fn new(entropy_source: ES, node_signer: NS, signer_provider: SP, fee_estimator: F, chain_monitor: M, tx_broadcaster: T, router: R, logger: L, default_config: UserConfig, - mut channel_monitors: Vec<&'a mut ChannelMonitor<::EcdsaSigner>>) -> Self { + pub fn new( + entropy_source: ES, node_signer: NS, signer_provider: SP, fee_estimator: F, + chain_monitor: M, tx_broadcaster: T, router: R, message_router: MR, logger: L, + default_config: UserConfig, + mut channel_monitors: Vec<&'a mut ChannelMonitor<::EcdsaSigner>>, + ) -> Self { Self { - entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, router, logger, default_config, + entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, + tx_broadcaster, router, message_router, logger, default_config, channel_monitors: hash_map_from_iter( channel_monitors.drain(..).map(|monitor| { (monitor.get_funding_txo().0, monitor) }) ), @@ -12092,8 +12137,8 @@ where // Implement ReadableArgs for an Arc'd ChannelManager to make it a bit easier to work with the // SipmleArcChannelManager type: -impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref> - ReadableArgs> for (BlockHash, Arc>) +impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> + ReadableArgs> for (BlockHash, Arc>) where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -12102,16 +12147,17 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { - fn read(reader: &mut Reader, args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>) -> Result { - let (blockhash, chan_manager) = <(BlockHash, ChannelManager)>::read(reader, args)?; + fn read(reader: &mut Reader, args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>) -> Result { + let (blockhash, chan_manager) = <(BlockHash, ChannelManager)>::read(reader, args)?; Ok((blockhash, Arc::new(chan_manager))) } } -impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref> - ReadableArgs> for (BlockHash, ChannelManager) +impl<'a, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> + ReadableArgs> for (BlockHash, ChannelManager) where M::Target: chain::Watch<::EcdsaSigner>, T::Target: BroadcasterInterface, @@ -12120,9 +12166,10 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { - fn read(reader: &mut Reader, mut args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, L>) -> Result { + fn read(reader: &mut Reader, mut args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>) -> Result { let _ver = read_ver_prefix!(reader, SERIALIZATION_VERSION); let chain_hash: ChainHash = Readable::read(reader)?; @@ -12913,6 +12960,7 @@ where chain_monitor: args.chain_monitor, tx_broadcaster: args.tx_broadcaster, router: args.router, + message_router: args.message_router, best_block: RwLock::new(BestBlock::new(best_block_hash, best_block_height)), @@ -14428,7 +14476,7 @@ pub mod bench { &'a test_utils::TestLogger, &'a P>, &'a test_utils::TestBroadcaster, &'a KeysManager, &'a KeysManager, &'a KeysManager, &'a test_utils::TestFeeEstimator, &'a test_utils::TestRouter<'a>, - &'a test_utils::TestLogger>; + &'a test_utils::TestMessageRouter<'a>, &'a test_utils::TestLogger>; struct ANodeHolder<'node_cfg, 'chan_mon_cfg: 'node_cfg, P: Persist> { node: &'node_cfg Manager<'chan_mon_cfg, P>, @@ -14456,7 +14504,9 @@ pub mod bench { let fee_estimator = test_utils::TestFeeEstimator::new(253); let logger_a = test_utils::TestLogger::with_id("node a".to_owned()); let scorer = RwLock::new(test_utils::TestScorer::new()); + let entropy = test_utils::TestKeysInterface::new(&[0u8; 32], network); let router = test_utils::TestRouter::new(Arc::new(NetworkGraph::new(network, &logger_a)), &logger_a, &scorer); + let message_router = test_utils::TestMessageRouter::new(Arc::new(NetworkGraph::new(network, &logger_a)), &entropy); let mut config: UserConfig = Default::default(); config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FeeRateMultiplier(5_000_000 / 253); @@ -14465,7 +14515,7 @@ pub mod bench { let chain_monitor_a = ChainMonitor::new(None, &tx_broadcaster, &logger_a, &fee_estimator, &persister_a); let seed_a = [1u8; 32]; let keys_manager_a = KeysManager::new(&seed_a, 42, 42); - let node_a = ChannelManager::new(&fee_estimator, &chain_monitor_a, &tx_broadcaster, &router, &logger_a, &keys_manager_a, &keys_manager_a, &keys_manager_a, config.clone(), ChainParameters { + let node_a = ChannelManager::new(&fee_estimator, &chain_monitor_a, &tx_broadcaster, &router, &message_router, &logger_a, &keys_manager_a, &keys_manager_a, &keys_manager_a, config.clone(), ChainParameters { network, best_block: BestBlock::from_network(network), }, genesis_block.header.time); @@ -14475,7 +14525,7 @@ pub mod bench { let chain_monitor_b = ChainMonitor::new(None, &tx_broadcaster, &logger_a, &fee_estimator, &persister_b); let seed_b = [2u8; 32]; let keys_manager_b = KeysManager::new(&seed_b, 42, 42); - let node_b = ChannelManager::new(&fee_estimator, &chain_monitor_b, &tx_broadcaster, &router, &logger_b, &keys_manager_b, &keys_manager_b, &keys_manager_b, config.clone(), ChainParameters { + let node_b = ChannelManager::new(&fee_estimator, &chain_monitor_b, &tx_broadcaster, &router, &message_router, &logger_b, &keys_manager_b, &keys_manager_b, &keys_manager_b, config.clone(), ChainParameters { network, best_block: BestBlock::from_network(network), }, genesis_block.header.time); diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 1c5af0d8f..549a32d6e 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -403,6 +403,7 @@ type TestChannelManager<'node_cfg, 'chan_mon_cfg> = ChannelManager< &'node_cfg test_utils::TestKeysInterface, &'chan_mon_cfg test_utils::TestFeeEstimator, &'node_cfg test_utils::TestRouter<'chan_mon_cfg>, + &'node_cfg test_utils::TestMessageRouter<'chan_mon_cfg>, &'chan_mon_cfg test_utils::TestLogger, >; @@ -433,6 +434,7 @@ pub struct Node<'chan_man, 'node_cfg: 'chan_man, 'chan_mon_cfg: 'node_cfg> { pub tx_broadcaster: &'chan_mon_cfg test_utils::TestBroadcaster, pub fee_estimator: &'chan_mon_cfg test_utils::TestFeeEstimator, pub router: &'node_cfg test_utils::TestRouter<'chan_mon_cfg>, + pub message_router: &'node_cfg test_utils::TestMessageRouter<'chan_mon_cfg>, pub chain_monitor: &'node_cfg test_utils::TestChainMonitor<'chan_mon_cfg>, pub keys_manager: &'chan_mon_cfg test_utils::TestKeysInterface, pub node: &'chan_man TestChannelManager<'node_cfg, 'chan_mon_cfg>, @@ -585,6 +587,7 @@ pub trait NodeHolder { ::SP, ::F, ::R, + ::MR, ::L>; fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor>; } @@ -598,6 +601,7 @@ impl NodeHolder for &H { ::SP, ::F, ::R, + ::MR, ::L> { (*self).node() } fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor> { (*self).chain_monitor() } } @@ -653,7 +657,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> { None => break, }; } - network_graph_deser + Arc::new(network_graph_deser) }; // Check that if we serialize and then deserialize all our channel monitors we get the @@ -687,13 +691,14 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> { let scorer = RwLock::new(test_utils::TestScorer::new()); let mut w = test_utils::TestVecWriter(Vec::new()); self.node.write(&mut w).unwrap(); - <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestLogger>)>::read(&mut io::Cursor::new(w.0), ChannelManagerReadArgs { + <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestMessageRouter, &test_utils::TestLogger>)>::read(&mut io::Cursor::new(w.0), ChannelManagerReadArgs { default_config: *self.node.get_current_default_configuration(), entropy_source: self.keys_manager, node_signer: self.keys_manager, signer_provider: self.keys_manager, fee_estimator: &test_utils::TestFeeEstimator::new(253), - router: &test_utils::TestRouter::new(Arc::new(network_graph), &self.logger, &scorer), + router: &test_utils::TestRouter::new(Arc::clone(&network_graph), &self.logger, &scorer), + message_router: &test_utils::TestMessageRouter::new(network_graph, self.keys_manager), chain_monitor: self.chain_monitor, tx_broadcaster: &broadcaster, logger: &self.logger, @@ -1121,6 +1126,7 @@ pub fn _reload_node<'a, 'b, 'c>(node: &'a Node<'a, 'b, 'c>, default_config: User signer_provider: node.keys_manager, fee_estimator: node.fee_estimator, router: node.router, + message_router: node.message_router, chain_monitor: node.chain_monitor, tx_broadcaster: node.tx_broadcaster, logger: node.logger, @@ -3239,7 +3245,7 @@ pub fn test_default_channel_config() -> UserConfig { default_config } -pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec>, node_config: &[Option]) -> Vec, &'b test_utils::TestBroadcaster, &'a test_utils::TestKeysInterface, &'a test_utils::TestKeysInterface, &'a test_utils::TestKeysInterface, &'b test_utils::TestFeeEstimator, &'a test_utils::TestRouter<'b>, &'b test_utils::TestLogger>> { +pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec>, node_config: &[Option]) -> Vec, &'b test_utils::TestBroadcaster, &'a test_utils::TestKeysInterface, &'a test_utils::TestKeysInterface, &'a test_utils::TestKeysInterface, &'b test_utils::TestFeeEstimator, &'a test_utils::TestRouter<'b>, &'a test_utils::TestMessageRouter<'b>, &'b test_utils::TestLogger>> { let mut chanmgrs = Vec::new(); for i in 0..node_count { let network = Network::Testnet; @@ -3248,7 +3254,7 @@ pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec network, best_block: BestBlock::from_network(network), }; - let node = ChannelManager::new(cfgs[i].fee_estimator, &cfgs[i].chain_monitor, cfgs[i].tx_broadcaster, &cfgs[i].router, cfgs[i].logger, cfgs[i].keys_manager, + let node = ChannelManager::new(cfgs[i].fee_estimator, &cfgs[i].chain_monitor, cfgs[i].tx_broadcaster, &cfgs[i].router, &cfgs[i].message_router, cfgs[i].logger, cfgs[i].keys_manager, cfgs[i].keys_manager, cfgs[i].keys_manager, if node_config[i].is_some() { node_config[i].clone().unwrap() } else { test_default_channel_config() }, params, genesis_block.header.time); chanmgrs.push(node); } @@ -3256,7 +3262,7 @@ pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec chanmgrs } -pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec>, chan_mgrs: &'a Vec, &'c test_utils::TestBroadcaster, &'b test_utils::TestKeysInterface, &'b test_utils::TestKeysInterface, &'b test_utils::TestKeysInterface, &'c test_utils::TestFeeEstimator, &'c test_utils::TestRouter, &'c test_utils::TestLogger>>) -> Vec> { +pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec>, chan_mgrs: &'a Vec, &'c test_utils::TestBroadcaster, &'b test_utils::TestKeysInterface, &'b test_utils::TestKeysInterface, &'b test_utils::TestKeysInterface, &'c test_utils::TestFeeEstimator, &'c test_utils::TestRouter, &'c test_utils::TestMessageRouter, &'c test_utils::TestLogger>>) -> Vec> { let mut nodes = Vec::new(); let chan_count = Rc::new(RefCell::new(0)); let payment_count = Rc::new(RefCell::new(0)); @@ -3273,8 +3279,9 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec>(mut vecs: Vec) -> impl /// confirmations during routing. /// /// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA -pub fn create_invoice_from_channelmanager( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +pub fn create_invoice_from_channelmanager( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description: String, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option, ) -> Result> @@ -342,6 +343,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { use std::time::SystemTime; @@ -370,8 +372,8 @@ where /// confirmations during routing. /// /// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA -pub fn create_invoice_from_channelmanager_with_description_hash( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +pub fn create_invoice_from_channelmanager_with_description_hash( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description_hash: Sha256, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option, ) -> Result> @@ -383,6 +385,7 @@ where SP::Target: SignerProvider, F::Target: FeeEstimator, R::Target: Router, + MR::Target: MessageRouter, L::Target: Logger, { use std::time::SystemTime; @@ -403,20 +406,21 @@ where #[cfg_attr(feature = "std", doc = "See [`create_invoice_from_channelmanager_with_description_hash`] for more information.")] #[cfg_attr(feature = "std", doc = "")] #[cfg_attr(feature = "std", doc = "This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller.")] -pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description_hash: Sha256, duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option, ) -> Result> - where - M::Target: chain::Watch<::EcdsaSigner>, - T::Target: BroadcasterInterface, - ES::Target: EntropySource, - NS::Target: NodeSigner, - SP::Target: SignerProvider, - F::Target: FeeEstimator, - R::Target: Router, - L::Target: Logger, +where + M::Target: chain::Watch<::EcdsaSigner>, + T::Target: BroadcasterInterface, + ES::Target: EntropySource, + NS::Target: NodeSigner, + SP::Target: SignerProvider, + F::Target: FeeEstimator, + R::Target: Router, + MR::Target: MessageRouter, + L::Target: Logger, { _create_invoice_from_channelmanager_and_duration_since_epoch( channelmanager, node_signer, logger, network, amt_msat, @@ -431,20 +435,21 @@ pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_sin #[cfg_attr(feature = "std", doc = "See [`create_invoice_from_channelmanager`] for more information.")] #[cfg_attr(feature = "std", doc = "")] #[cfg_attr(feature = "std", doc = "This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller.")] -pub fn create_invoice_from_channelmanager_and_duration_since_epoch( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +pub fn create_invoice_from_channelmanager_and_duration_since_epoch( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description: String, duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option, ) -> Result> - where - M::Target: chain::Watch<::EcdsaSigner>, - T::Target: BroadcasterInterface, - ES::Target: EntropySource, - NS::Target: NodeSigner, - SP::Target: SignerProvider, - F::Target: FeeEstimator, - R::Target: Router, - L::Target: Logger, +where + M::Target: chain::Watch<::EcdsaSigner>, + T::Target: BroadcasterInterface, + ES::Target: EntropySource, + NS::Target: NodeSigner, + SP::Target: SignerProvider, + F::Target: FeeEstimator, + R::Target: Router, + MR::Target: MessageRouter, + L::Target: Logger, { _create_invoice_from_channelmanager_and_duration_since_epoch( channelmanager, node_signer, logger, network, amt_msat, @@ -455,20 +460,21 @@ pub fn create_invoice_from_channelmanager_and_duration_since_epoch( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +fn _create_invoice_from_channelmanager_and_duration_since_epoch( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description: Bolt11InvoiceDescription, duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option, ) -> Result> - where - M::Target: chain::Watch<::EcdsaSigner>, - T::Target: BroadcasterInterface, - ES::Target: EntropySource, - NS::Target: NodeSigner, - SP::Target: SignerProvider, - F::Target: FeeEstimator, - R::Target: Router, - L::Target: Logger, +where + M::Target: chain::Watch<::EcdsaSigner>, + T::Target: BroadcasterInterface, + ES::Target: EntropySource, + NS::Target: NodeSigner, + SP::Target: SignerProvider, + F::Target: FeeEstimator, + R::Target: Router, + MR::Target: MessageRouter, + L::Target: Logger, { if min_final_cltv_expiry_delta.is_some() && min_final_cltv_expiry_delta.unwrap().saturating_add(3) < MIN_FINAL_CLTV_EXPIRY_DELTA { return Err(SignOrCreationError::CreationError(CreationError::MinFinalCltvExpiryDeltaTooShort)); @@ -488,20 +494,21 @@ fn _create_invoice_from_channelmanager_and_duration_since_epoch( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description: String, duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, payment_hash: PaymentHash, min_final_cltv_expiry_delta: Option, ) -> Result> - where - M::Target: chain::Watch<::EcdsaSigner>, - T::Target: BroadcasterInterface, - ES::Target: EntropySource, - NS::Target: NodeSigner, - SP::Target: SignerProvider, - F::Target: FeeEstimator, - R::Target: Router, - L::Target: Logger, +where + M::Target: chain::Watch<::EcdsaSigner>, + T::Target: BroadcasterInterface, + ES::Target: EntropySource, + NS::Target: NodeSigner, + SP::Target: SignerProvider, + F::Target: FeeEstimator, + R::Target: Router, + MR::Target: MessageRouter, + L::Target: Logger, { let payment_secret = channelmanager .create_inbound_payment_for_hash(payment_hash, amt_msat, invoice_expiry_delta_secs, @@ -517,21 +524,22 @@ pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_ ) } -fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash( - channelmanager: &ChannelManager, node_signer: NS, logger: L, +fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash( + channelmanager: &ChannelManager, node_signer: NS, logger: L, network: Currency, amt_msat: Option, description: Bolt11InvoiceDescription, duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, payment_hash: PaymentHash, payment_secret: PaymentSecret, min_final_cltv_expiry_delta: Option, ) -> Result> - where - M::Target: chain::Watch<::EcdsaSigner>, - T::Target: BroadcasterInterface, - ES::Target: EntropySource, - NS::Target: NodeSigner, - SP::Target: SignerProvider, - F::Target: FeeEstimator, - R::Target: Router, - L::Target: Logger, +where + M::Target: chain::Watch<::EcdsaSigner>, + T::Target: BroadcasterInterface, + ES::Target: EntropySource, + NS::Target: NodeSigner, + SP::Target: SignerProvider, + F::Target: FeeEstimator, + R::Target: Router, + MR::Target: MessageRouter, + L::Target: Logger, { let our_node_pubkey = channelmanager.get_our_node_id(); let channels = channelmanager.list_channels(); diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 5293906f9..cb61b4dee 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -703,10 +703,10 @@ pub type SimpleArcPeerManager = PeerManager< /// This is not exported to bindings users as type aliases aren't supported in most languages. #[cfg(not(c_bindings))] pub type SimpleRefPeerManager< - 'a, 'b, 'c, 'd, 'e, 'f, 'logger, 'h, 'i, 'j, 'graph, 'k, SD, M, T, F, C, L + 'a, 'b, 'c, 'd, 'e, 'f, 'logger, 'h, 'i, 'j, 'graph, 'k, 'mr, SD, M, T, F, C, L > = PeerManager< SD, - &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'graph, 'logger, 'i, M, T, F, L>, + &'j SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'graph, 'logger, 'i, 'mr, M, T, F, L>, &'f P2PGossipSync<&'graph NetworkGraph<&'logger L>, C, &'logger L>, &'h SimpleRefOnionMessenger<'a, 'b, 'c, 'd, 'e, 'graph, 'logger, 'i, 'j, 'k, M, T, F, L>, &'logger L, diff --git a/lightning/src/ln/reload_tests.rs b/lightning/src/ln/reload_tests.rs index 129b83eae..6ae465b32 100644 --- a/lightning/src/ln/reload_tests.rs +++ b/lightning/src/ln/reload_tests.rs @@ -415,13 +415,14 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() { let mut nodes_0_read = &nodes_0_serialized[..]; if let Err(msgs::DecodeError::DangerousValue) = - <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs { + <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestMessageRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs { default_config: UserConfig::default(), entropy_source: keys_manager, node_signer: keys_manager, signer_provider: keys_manager, fee_estimator: &fee_estimator, router: &nodes[0].router, + message_router: &nodes[0].message_router, chain_monitor: nodes[0].chain_monitor, tx_broadcaster: nodes[0].tx_broadcaster, logger: &logger, @@ -432,13 +433,14 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() { let mut nodes_0_read = &nodes_0_serialized[..]; let (_, nodes_0_deserialized_tmp) = - <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs { + <(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestMessageRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs { default_config: UserConfig::default(), entropy_source: keys_manager, node_signer: keys_manager, signer_provider: keys_manager, fee_estimator: &fee_estimator, router: nodes[0].router, + message_router: &nodes[0].message_router, chain_monitor: nodes[0].chain_monitor, tx_broadcaster: nodes[0].tx_broadcaster, logger: &logger, diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index ab7ccbdab..4b7ba02e4 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -1821,10 +1821,10 @@ pub type SimpleRefOnionMessenger< &'a KeysManager, &'a KeysManager, &'b L, - &'i SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L>, - &'j DefaultMessageRouter<&'g NetworkGraph<&'b L>, &'b L, &'a KeysManager>, - &'i SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L>, - &'i SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, 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>, IgnoringMessageHandler >;