From 5281c48f70f5d2f324036dbcc38ca966327e260d Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Fri, 24 Jul 2015 09:10:08 -0700 Subject: [PATCH] Fix syncing issues - if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight || pindexPrev->nTime + 600 < GetTime()) return; -- && allowed skipping in various situations, which caused blocks to be rejected because of lack of mnfinalbudget data --- src/masternode-payments.cpp | 1 + src/masternode-sync.cpp | 2 +- src/masternode.cpp | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 18107be1f..8993c1ffe 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -225,6 +225,7 @@ bool IsBlockValueValid(const CBlock& block, int64_t nExpectedValue){ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight) { if(!masternodeSync.IsSynced()) { //there is no budget data to use to check anything -- find the longest chain + if(fDebug) LogPrintf("Client not synced, skipping block payee checks\n"); return true; } diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index 2ab42f7be..6f2dffdf0 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -136,7 +136,7 @@ void CMasternodeSync::Process() if(IsInitialBlockDownload()) return; //don't begin syncing until we're almost at a recent block - if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight && pindexPrev->nTime + 600 < GetTime()) return; + if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight || pindexPrev->nTime + 600 < GetTime()) return; if (pnode->nVersion >= masternodePayments.GetMinMasternodePaymentsProto()) { diff --git a/src/masternode.cpp b/src/masternode.cpp index b425b09c4..c2a32bf78 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -157,7 +157,10 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight) uint256 hash = 0; uint256 aux = vin.prevout.hash + vin.prevout.n; - if(!GetBlockHash(hash, nBlockHeight)) return 0; + if(!GetBlockHash(hash, nBlockHeight)) { + LogPrintf("CalculateScore ERROR - nHeight %d - Returned 0\n", nBlockHeight); + return 0; + } CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); ss << hash;