mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Remove temporary fork handling for emergency difficulty reduction on testnet
As we reset testnet, we can also remove the special handling for old blocks.
This commit is contained in:
parent
db4f43f874
commit
0fca0e6fc8
27
src/pow.cpp
27
src/pow.cpp
@ -89,26 +89,7 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
|
||||
return bnPowLimit.GetCompact();
|
||||
}
|
||||
|
||||
if (params.fPowAllowMinDifficultyBlocks && (
|
||||
// testnet ...
|
||||
(params.hashDevnetGenesisBlock.IsNull() && pindexLast->nChainWork >= UintToArith256(uint256S("0x000000000000000000000000000000000000000000000000003e9ccfe0e03e01"))) ||
|
||||
// or devnet
|
||||
!params.hashDevnetGenesisBlock.IsNull())) {
|
||||
// NOTE: 000000000000000000000000000000000000000000000000003e9ccfe0e03e01 is the work of the "wrong" chain,
|
||||
// so this rule activates there immediately and new blocks with high diff from that chain are going
|
||||
// to be rejected by updated nodes. Note, that old nodes are going to reject blocks from updated nodes
|
||||
// after the "right" chain reaches this amount of work too. This is a temporary condition which should
|
||||
// be removed when we decide to hard-fork testnet again.
|
||||
// TODO: remove "testnet+work OR devnet" part on next testnet hard-fork
|
||||
// Special difficulty rule for testnet/devnet:
|
||||
// If the new block's timestamp is more than 2* 2.5 minutes
|
||||
// then allow mining of a min-difficulty block.
|
||||
|
||||
// start using smoother adjustment on testnet when total work hits
|
||||
// 000000000000000000000000000000000000000000000000003ff00000000000
|
||||
if (pindexLast->nChainWork >= UintToArith256(uint256S("0x000000000000000000000000000000000000000000000000003ff00000000000"))
|
||||
// and immediately on devnet
|
||||
|| !params.hashDevnetGenesisBlock.IsNull()) {
|
||||
if (params.fPowAllowMinDifficultyBlocks) {
|
||||
// recent block is more than 2 hours old
|
||||
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + 2 * 60 * 60) {
|
||||
return bnPowLimit.GetCompact();
|
||||
@ -121,12 +102,6 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
|
||||
}
|
||||
return bnNew.GetCompact();
|
||||
}
|
||||
} else {
|
||||
// old stuff
|
||||
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2) {
|
||||
return bnPowLimit.GetCompact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CBlockIndex *pindex = pindexLast;
|
||||
|
Loading…
Reference in New Issue
Block a user