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
This commit is contained in:
Evan Duffield 2015-07-24 09:10:08 -07:00
parent 9e65749ff6
commit 5281c48f70
3 changed files with 6 additions and 2 deletions

View File

@ -225,6 +225,7 @@ bool IsBlockValueValid(const CBlock& block, int64_t nExpectedValue){
bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight) 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(!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; return true;
} }

View File

@ -136,7 +136,7 @@ void CMasternodeSync::Process()
if(IsInitialBlockDownload()) return; if(IsInitialBlockDownload()) return;
//don't begin syncing until we're almost at a recent block //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()) { if (pnode->nVersion >= masternodePayments.GetMinMasternodePaymentsProto()) {

View File

@ -157,7 +157,10 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight)
uint256 hash = 0; uint256 hash = 0;
uint256 aux = vin.prevout.hash + vin.prevout.n; 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); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << hash; ss << hash;