@@ -179,7 +179,7 @@ class CDeterministicMNList
179179 // for multiple CDeterministicMNList until mnMap is actually changed.
180180 // Calls of AddMN, RemoveMN and (in some cases) UpdateMN reset this cache;
181181 // it happens also for indirect calls such as ApplyDiff
182- mutable std::shared_ptr<const CSimplifiedMNList> m_cached_sml;
182+ mutable std::atomic<std:: shared_ptr<const CSimplifiedMNList> > m_cached_sml;
183183
184184public:
185185 CDeterministicMNList () = default ;
@@ -191,6 +191,31 @@ class CDeterministicMNList
191191 assert (nHeight >= 0 );
192192 }
193193
194+ CDeterministicMNList (const CDeterministicMNList& other) :
195+ blockHash (other.blockHash),
196+ nHeight (other.nHeight),
197+ nTotalRegisteredCount (other.nTotalRegisteredCount),
198+ mnMap (other.mnMap),
199+ mnInternalIdMap (other.mnInternalIdMap),
200+ mnUniquePropertyMap (other.mnUniquePropertyMap),
201+ m_cached_sml{other.m_cached_sml .load ()}
202+ {
203+ }
204+
205+ CDeterministicMNList& operator =(const CDeterministicMNList& other)
206+ {
207+ if (this != &other) {
208+ blockHash = other.blockHash ;
209+ nHeight = other.nHeight ;
210+ nTotalRegisteredCount = other.nTotalRegisteredCount ;
211+ mnMap = other.mnMap ;
212+ mnInternalIdMap = other.mnInternalIdMap ;
213+ mnUniquePropertyMap = other.mnUniquePropertyMap ;
214+ m_cached_sml = other.m_cached_sml .load ();
215+ }
216+ return *this ;
217+ }
218+
194219 template <typename Stream, typename Operation>
195220 inline void SerializationOpBase (Stream& s, Operation ser_action)
196221 {
0 commit comments