Skip to content

Commit

Permalink
Fix sync issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Aug 22, 2014
1 parent ecd2402 commit 1a926a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 3 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,24 +1259,19 @@ unsigned int static NiteGravityWell(const CBlockIndex* pindexLast, const CBlockH
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
{
int nHeight = pindexLast->nHeight + 1;
int diffMode = 0;
if (nHeight >= nHardFork || (fTestNet && (nHeight >= nTestFork))) {
if (nHeight >= nHardFork) {
if (!x3Fork) x3Fork = true;
nTargetSpacing = 2 * 60; // Deepcoin: 2 minute block target after
if (nHeight == nHardFork) return(difficultyReset.GetCompact());
if (nHeight < nHardFork + 10) diffMode = 1;
if (fTestNet && (nHeight == nTestFork)) return(difficultyReset.GetCompact());
if (fTestNet && (nHeight < nTestFork + 10)) diffMode = 1;
if (nHeight < nHardFork + 10) return GetNextWorkRequired_V1(pindexLast, pblock);
}

static const int64 BlocksTargetSpacing = nTargetSpacing;
static const unsigned int TimeDaySeconds = nTargetTimespan;
int64 PastSecondsMin = TimeDaySeconds * 0.25;
int64 PastSecondsMax = TimeDaySeconds * 7;
uint64 PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
uint64 PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;

if (diffMode == 1) return GetNextWorkRequired_V1(pindexLast, pblock);
return NiteGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ static const int fHaveUPnP = true;
static const int fHaveUPnP = false;
#endif

static const int nTestFork = 40;
static const int nHardFork = 76800;
static const int nSoftFork = 1408406400;

Expand Down Expand Up @@ -1380,7 +1379,7 @@ class CBlock : public CBlockHeader
uint256 GetPoWHash() const
{
int nHeight = GetBlockHeight();
if ((nHeight >= nHardFork) || (fTestNet && (nHeight >= nTestFork))) {
if (nHeight >= nHardFork) {
return Hash3(BEGIN(nVersion), END(nNonce));
}
return Hash5(BEGIN(nVersion), END(nNonce));
Expand Down

0 comments on commit 1a926a7

Please sign in to comment.