From: Arik Sosman Date: Thu, 17 Aug 2023 21:19:32 +0000 (-0700) Subject: Fix bench lifetimes. X-Git-Tag: v0.0.117-alpha1~47^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=d256a2b329c0493f85b02901d257e1e45d5ef7d1;p=rust-lightning 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. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 91ce2e5a4..5d2fad1c7 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 } }