Skip to content

Commit 828b639

Browse files
authored
Fix mn list sync (#1401)
* 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
1 parent 903483c commit 828b639

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: src/masternode.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,17 @@ bool CMasternodePing::CheckAndUpdate(CMasternode* pmn, bool fFromNewBroadcast, i
840840

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

843-
// so, ping seems to be ok, let's store it
843+
// so, ping seems to be ok
844+
845+
// if we are still syncing and there was no known ping for this mn for quite a while
846+
// (NOTE: assuming that MASTERNODE_EXPIRATION_SECONDS/2 should be enough to finish mn list sync)
847+
if(!masternodeSync.IsMasternodeListSynced() && !pmn->IsPingedWithin(MASTERNODE_EXPIRATION_SECONDS/2)) {
848+
// let's bump sync timeout
849+
LogPrint("masternode", "CMasternodePing::CheckAndUpdate -- bumping sync timeout, masternode=%s\n", vin.prevout.ToStringShort());
850+
masternodeSync.AddedMasternodeList();
851+
}
852+
853+
// let's store this ping as the last one
844854
LogPrint("masternode", "CMasternodePing::CheckAndUpdate -- Masternode ping accepted, masternode=%s\n", vin.prevout.ToStringShort());
845855
pmn->lastPing = *this;
846856

0 commit comments

Comments
 (0)