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.
This commit is contained in:
Carl Dong committed 2022-05-20 11:57:54 -04:00
1 parent 04c31c1295
commit 53494bc739
1 file changed
+1 -1
+1 -1
View File
@@ -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<int64_t()> m_adjusted_time_callback;