Skip to content

Commit a1ef547

Browse files
authored
only consider higher hashes if they don't exceed nExpirationDelay (#1361)
1 parent 0bc6d92 commit a1ef547

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/governance.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,11 @@ bool CGovernanceManager::UpdateCurrentWatchdog(CGovernanceObject& watchdogNew)
390390
int64_t nExpirationDelay = GOVERNANCE_WATCHDOG_EXPIRATION_TIME / 2;
391391
int64_t nNow = GetTime();
392392

393-
if((nHashWatchdogCurrent == uint256()) ||
394-
(((nNow - nTimeWatchdogCurrent) > nExpirationDelay) && (nNow - watchdogNew.GetCreationTime() < nExpirationDelay)) ||
395-
(nHashNew > nHashCurrent)) {
393+
if(nHashWatchdogCurrent == uint256() || // no known current OR
394+
((nNow - watchdogNew.GetCreationTime() < nExpirationDelay) && // (new one is NOT expired AND
395+
((nNow - nTimeWatchdogCurrent > nExpirationDelay) || (nHashNew > nHashCurrent)))// (current is expired OR
396+
// its hash is lower))
397+
) {
396398
LOCK(cs);
397399
object_m_it it = mapObjects.find(nHashWatchdogCurrent);
398400
if(it != mapObjects.end()) {

0 commit comments

Comments
 (0)