From 53494bc7392591336e09d095f1fc38d63d566abf Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Wed, 18 May 2022 12:01:56 -0400 Subject: [PATCH] validation: Have ChainstateManager own m_chainparams We want m_chainparams to be alive for the duration of ChainstateManager's lifetime since ChainstateManager's behaviour depends on m_chainparams. We could allow for a std::shared_ptr to be passed in as m_chainparams, but that complicates things further. Given that CChainParams is not an entity class or struct, we can just copy it and have ChainstateManager own it. --- src/validation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation.h b/src/validation.h index 6f4404e7ec6..31dd0890053 100644 --- a/src/validation.h +++ b/src/validation.h @@ -836,7 +836,7 @@ private: CBlockIndex* m_best_invalid GUARDED_BY(::cs_main){nullptr}; - const CChainParams& m_chainparams; + const CChainParams m_chainparams; const std::function m_adjusted_time_callback;