Skip to content

Commit

Permalink
Fix mn list sync (#1401)
Browse files Browse the repository at this point in the history
* Fix mn list sync

Bump sync timeout if masternode is "initially valid" and last ping was quite a long time ago

* compare to current time
  • Loading branch information
UdjinM6 committed Mar 20, 2017
1 parent 903483c commit 828b639
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,17 @@ bool CMasternodePing::CheckAndUpdate(CMasternode* pmn, bool fFromNewBroadcast, i

if (!CheckSignature(pmn->pubKeyMasternode, nDos)) return false;

// so, ping seems to be ok, let's store it
// so, ping seems to be ok

// if we are still syncing and there was no known ping for this mn for quite a while
// (NOTE: assuming that MASTERNODE_EXPIRATION_SECONDS/2 should be enough to finish mn list sync)
if(!masternodeSync.IsMasternodeListSynced() && !pmn->IsPingedWithin(MASTERNODE_EXPIRATION_SECONDS/2)) {
// let's bump sync timeout
LogPrint("masternode", "CMasternodePing::CheckAndUpdate -- bumping sync timeout, masternode=%s\n", vin.prevout.ToStringShort());
masternodeSync.AddedMasternodeList();
}

// let's store this ping as the last one
LogPrint("masternode", "CMasternodePing::CheckAndUpdate -- Masternode ping accepted, masternode=%s\n", vin.prevout.ToStringShort());
pmn->lastPing = *this;

Expand Down

0 comments on commit 828b639

Please sign in to comment.