fix nLastWatchdogVoteTime updates (#1679)

This commit is contained in:
UdjinM6 2017-10-12 15:05:17 +03:00 committed by GitHub
parent 58f9f9bbec
commit cd47ac3faa
2 changed files with 5 additions and 5 deletions

View File

@ -820,7 +820,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
// we shoud update nTimeLastWatchdogVote here if sentinel // we shoud update nTimeLastWatchdogVote here if sentinel
// ping flag is actual // ping flag is actual
if(pmn && mnp.fSentinelIsCurrent) if(pmn && mnp.fSentinelIsCurrent)
pmn->UpdateWatchdogVoteTime(mnp.sigTime); UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
// too late, new MNANNOUNCE is required // too late, new MNANNOUNCE is required
if(pmn && pmn->IsNewStartRequired()) return; if(pmn && pmn->IsNewStartRequired()) return;
@ -1481,14 +1481,14 @@ void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex)
IsFirstRun = false; IsFirstRun = false;
} }
void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint) void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime)
{ {
LOCK(cs); LOCK(cs);
CMasternode* pmn = Find(outpoint); CMasternode* pmn = Find(outpoint);
if(!pmn) { if(!pmn) {
return; return;
} }
pmn->UpdateWatchdogVoteTime(); pmn->UpdateWatchdogVoteTime(nVoteTime);
nLastWatchdogVoteTime = GetTime(); nLastWatchdogVoteTime = GetTime();
} }
@ -1548,7 +1548,7 @@ void CMasternodeMan::SetMasternodeLastPing(const COutPoint& outpoint, const CMas
// we shoud update nTimeLastWatchdogVote here if sentinel // we shoud update nTimeLastWatchdogVote here if sentinel
// ping flag is actual // ping flag is actual
if(mnp.fSentinelIsCurrent) { if(mnp.fSentinelIsCurrent) {
pmn->UpdateWatchdogVoteTime(mnp.sigTime); UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
} }
mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp)); mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp));

View File

@ -219,7 +219,7 @@ public:
} }
bool IsWatchdogActive(); bool IsWatchdogActive();
void UpdateWatchdogVoteTime(const COutPoint& outpoint); void UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime = 0);
bool AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash); bool AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash);
void RemoveGovernanceObject(uint256 nGovernanceObjectHash); void RemoveGovernanceObject(uint256 nGovernanceObjectHash);