]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix bench lifetimes.
authorArik Sosman <git@arik.io>
Thu, 17 Aug 2023 21:19:32 +0000 (14:19 -0700)
committerArik Sosman <git@arik.io>
Tue, 22 Aug 2023 21:25:23 +0000 (14:25 -0700)
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

index 91ce2e5a47402c7d05bd885ce9bb602da88b7a2c..5d2fad1c7f2c0fccdf661340c948df416406c70c 100644 (file)
@@ -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<InMemorySigner>> {
-               node: &'a Manager<'a, P>,
+       struct ANodeHolder<'node_cfg, 'chan_mon_cfg: 'node_cfg, P: Persist<InMemorySigner>> {
+               node: &'node_cfg Manager<'chan_mon_cfg, P>,
        }
-       impl<'a, P: Persist<InMemorySigner>> NodeHolder for ANodeHolder<'a, P> {
-               type CM = Manager<'a, P>;
+       impl<'node_cfg, 'chan_mon_cfg: 'node_cfg, P: Persist<InMemorySigner>> 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 }
        }