@@ -143,7 +143,8 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& msg_typ
143143 return ;
144144 }
145145
146- LOCK2 (cs_main, cs);
146+ LOCK2 (cs_main, ::mempool.cs ); // Lock mempool because of GetTransaction deep inside
147+ LOCK (cs);
147148
148149 if (mapObjects.count (nHash) || mapPostponedObjects.count (nHash) || mapErasedGovernanceObjects.count (nHash)) {
149150 // TODO - print error code? what if it's GOVOBJ_ERROR_IMMATURE?
@@ -262,7 +263,8 @@ void CGovernanceManager::AddGovernanceObject(CGovernanceObject& govobj, CConnman
262263
263264 govobj.UpdateSentinelVariables (); // this sets local vars in object
264265
265- LOCK2 (cs_main, cs);
266+ LOCK2 (cs_main, ::mempool.cs ); // Lock mempool because of GetTransaction deep inside
267+ LOCK (cs);
266268 std::string strError;
267269
268270 // MAKE SURE THIS OBJECT IS OK
@@ -321,7 +323,8 @@ void CGovernanceManager::UpdateCachesAndClean()
321323
322324 std::vector<uint256> vecDirtyHashes = mmetaman.GetAndClearDirtyGovernanceObjectHashes ();
323325
324- LOCK2 (cs_main, cs);
326+ LOCK2 (cs_main, ::mempool.cs ); // Lock mempool because of GetTransaction deep inside
327+ LOCK (cs);
325328
326329 for (const uint256& nHash : vecDirtyHashes) {
327330 auto it = mapObjects.find (nHash);
@@ -836,7 +839,8 @@ void CGovernanceManager::CheckPostponedObjects(CConnman& connman)
836839{
837840 if (!masternodeSync.IsSynced ()) return ;
838841
839- LOCK2 (cs_main, cs);
842+ LOCK2 (cs_main, ::mempool.cs ); // Lock mempool because of GetTransaction deep inside
843+ LOCK (cs);
840844
841845 // Check postponed proposals
842846 for (auto it = mapPostponedObjects.begin (); it != mapPostponedObjects.end ();) {
0 commit comments