Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGovernanceManager initialization fix #1138

Merged
merged 4 commits into from
Nov 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
LOCK(cs);
// MAKE SURE WE HAVE A VALID REFERENCE TO THE TIP BEFORE CONTINUING

if(!pCurrentBlockIndex) return;
if(!pCurrentBlockIndex) {
LogPrintf("CGovernanceManager::ProcessMessage MNGOVERNANCEOBJECT -- pCurrentBlockIndex is NULL\n");
return;
}

CGovernanceObject govobj;
vRecv >> govobj;
Expand Down Expand Up @@ -172,7 +175,10 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
else if (strCommand == NetMsgType::MNGOVERNANCEOBJECTVOTE)
{
// Ignore such messages until masternode list is synced
if(!masternodeSync.IsMasternodeListSynced()) return;
if(!masternodeSync.IsMasternodeListSynced()) {
LogPrint("gobject", "CGovernanceManager::ProcessMessage MNGOVERNANCEOBJECTVOTE -- masternode list not synced\n");
return;
}

CGovernanceVote vote;
vRecv >> vote;
Expand Down Expand Up @@ -1125,6 +1131,10 @@ void CGovernanceManager::UpdatedBlockTip(const CBlockIndex *pindex)
// On the other hand it should be safe for us to access pindex without holding a lock
// on cs_main because the CBlockIndex objects are dynamically allocated and
// presumably never deleted.
if(!pindex) {
return;
}

LOCK(cs);
pCurrentBlockIndex = pindex;
nCachedBlockHeight = pCurrentBlockIndex->nHeight;
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
darkSendPool.UpdatedBlockTip(chainActive.Tip());
mnpayments.UpdatedBlockTip(chainActive.Tip());
masternodeSync.UpdatedBlockTip(chainActive.Tip());
governance.UpdatedBlockTip(chainActive.Tip());

// ********************************************************* Step 11d: start dash-privatesend thread

Expand Down