|
|
@ -850,22 +850,19 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast) |
|
|
|
return bnNew.GetCompact(); |
|
|
|
return bnNew.GetCompact(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vector<int> vStartingHeight; |
|
|
|
bool IsInitialBlockDownload() |
|
|
|
void AddStartingHeight(int nStartingHeight) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (nStartingHeight != -1) |
|
|
|
if (pindexBest == NULL) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
static int64 nLastUpdate; |
|
|
|
|
|
|
|
static CBlockIndex* pindexLastBest; |
|
|
|
|
|
|
|
if (pindexBest != pindexLastBest) |
|
|
|
{ |
|
|
|
{ |
|
|
|
vStartingHeight.push_back(nStartingHeight); |
|
|
|
pindexLastBest = pindexBest; |
|
|
|
sort(vStartingHeight.begin(), vStartingHeight.end()); |
|
|
|
nLastUpdate = GetTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return (GetTime() - nLastUpdate < 10 && |
|
|
|
|
|
|
|
pindexBest->nTime < GetTime() - 24 * 60 * 60); |
|
|
|
bool IsInitialBlockDownload() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int nMedian = 69000; |
|
|
|
|
|
|
|
if (vStartingHeight.size() >= 5) |
|
|
|
|
|
|
|
nMedian = vStartingHeight[vStartingHeight.size()/2]; |
|
|
|
|
|
|
|
return nBestHeight < nMedian-1000; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1923,7 +1920,6 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AddTimeData(pfrom->addr.ip, nTime); |
|
|
|
AddTimeData(pfrom->addr.ip, nTime); |
|
|
|
AddStartingHeight(pfrom->nStartingHeight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change version
|
|
|
|
// Change version
|
|
|
|
if (pfrom->nVersion >= 209) |
|
|
|
if (pfrom->nVersion >= 209) |
|
|
|