From d256a2b329c0493f85b02901d257e1e45d5ef7d1 Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Thu, 17 Aug 2023 14:19:32 -0700 Subject: [PATCH] Fix bench lifetimes. Benchmarks were failing because node config and channel monitor configs were tied to the same lifetime. Introducing a separate lifetime allows to avoid out-of-order deallocation errors. --- lightning/src/ln/channelmanager.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 91ce2e5a..5d2fad1c 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -10534,13 +10534,13 @@ pub mod bench { &'a test_utils::TestFeeEstimator, &'a test_utils::TestRouter<'a>, &'a test_utils::TestLogger>; - struct ANodeHolder<'a, P: Persist> { - node: &'a Manager<'a, P>, + struct ANodeHolder<'node_cfg, 'chan_mon_cfg: 'node_cfg, P: Persist> { + node: &'node_cfg Manager<'chan_mon_cfg, P>, } - impl<'a, P: Persist> NodeHolder for ANodeHolder<'a, P> { - type CM = Manager<'a, P>; + impl<'node_cfg, 'chan_mon_cfg: 'node_cfg, P: Persist> NodeHolder for ANodeHolder<'node_cfg, 'chan_mon_cfg, P> { + type CM = Manager<'chan_mon_cfg, P>; #[inline] - fn node(&self) -> &Manager<'a, P> { self.node } + fn node(&self) -> &Manager<'chan_mon_cfg, P> { self.node } #[inline] fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor> { None } } -- 2.30.2