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
2022-05-18 12:01:56 -04:00
parent 04c31c1295
commit 53494bc739

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;