Skip to content

Commit 9294bbf

Browse files
committed
Modify GetNextWorkRequired to set Target Limit correctly on first PoS block
1 parent b9ce433 commit 9294bbf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4509,8 +4509,17 @@ bool CheckWork(const CBlock block, CBlockIndex* const pindexPrev)
45094509
return true;
45104510
}
45114511

4512-
if (block.nBits != nBitsRequired)
4512+
if (block.nBits != nBitsRequired) {
4513+
// Pivx Specific reference to the block with the wrong threshold was used.
4514+
static const int64_t PivxBadBlockTime = 1471401614;
4515+
static const unsigned int PivxBadBlocknBits = 0x1c056dac;
4516+
if ((block.nTime == PivxBadBlockTime) && (block.nBits == PivxBadBlocknBits)) {
4517+
// accept PIVX block minted with incorrect proof of work threshold
4518+
return true;
4519+
}
4520+
45134521
return error("%s : incorrect proof of work at %d", __func__, pindexPrev->nHeight + 1);
4522+
}
45144523

45154524
return true;
45164525
}

src/pow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
3737
return Params().ProofOfWorkLimit().GetCompact();
3838
}
3939

40-
if (pindexLast->nHeight > Params().LAST_POW_BLOCK()) {
40+
if (pindexLast->nHeight >= Params().LAST_POW_BLOCK()) {
4141
uint256 bnTargetLimit = (~uint256(0) >> 24);
4242
int64_t nTargetSpacing = 60;
4343
int64_t nTargetTimespan = 60 * 40;

0 commit comments

Comments
 (0)