From cd47ac3faa17c81a1946d5a1408d38333eb8971d Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 12 Oct 2017 15:05:17 +0300 Subject: [PATCH] fix nLastWatchdogVoteTime updates (#1679) --- src/masternodeman.cpp | 8 ++++---- src/masternodeman.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 153a0c4dd..458c7b48d 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -820,7 +820,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData // we shoud update nTimeLastWatchdogVote here if sentinel // ping flag is actual if(pmn && mnp.fSentinelIsCurrent) - pmn->UpdateWatchdogVoteTime(mnp.sigTime); + UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); // too late, new MNANNOUNCE is required if(pmn && pmn->IsNewStartRequired()) return; @@ -1481,14 +1481,14 @@ void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex) IsFirstRun = false; } -void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint) +void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime) { LOCK(cs); CMasternode* pmn = Find(outpoint); if(!pmn) { return; } - pmn->UpdateWatchdogVoteTime(); + pmn->UpdateWatchdogVoteTime(nVoteTime); nLastWatchdogVoteTime = GetTime(); } @@ -1548,7 +1548,7 @@ void CMasternodeMan::SetMasternodeLastPing(const COutPoint& outpoint, const CMas // we shoud update nTimeLastWatchdogVote here if sentinel // ping flag is actual if(mnp.fSentinelIsCurrent) { - pmn->UpdateWatchdogVoteTime(mnp.sigTime); + UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); } mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp)); diff --git a/src/masternodeman.h b/src/masternodeman.h index 06586d0cf..0ac5f31f6 100644 --- a/src/masternodeman.h +++ b/src/masternodeman.h @@ -219,7 +219,7 @@ public: } bool IsWatchdogActive(); - void UpdateWatchdogVoteTime(const COutPoint& outpoint); + void UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime = 0); bool AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash); void RemoveGovernanceObject(uint256 nGovernanceObjectHash);