Rename min-difficulty flag to remove off-by-one in the name
This commit is contained in:
parent
b86dc98047
commit
1f7ee4af70
|
@ -95,7 +95,7 @@ public:
|
|||
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
|
||||
consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
|
||||
consensus.nPowTargetSpacing = 2.5 * 60;
|
||||
consensus.nPowAllowMinDifficultyBlocksFromHeight = boost::none;
|
||||
consensus.nPowAllowMinDifficultyBlocksAfterHeight = boost::none;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight =
|
||||
Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
|
||||
consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
|
||||
consensus.nPowTargetSpacing = 2.5 * 60;
|
||||
consensus.nPowAllowMinDifficultyBlocksFromHeight = 299187;
|
||||
consensus.nPowAllowMinDifficultyBlocksAfterHeight = 299187;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight =
|
||||
Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
|
||||
|
@ -393,7 +393,7 @@ public:
|
|||
consensus.nPowMaxAdjustDown = 0; // Turn off adjustment down
|
||||
consensus.nPowMaxAdjustUp = 0; // Turn off adjustment up
|
||||
consensus.nPowTargetSpacing = 2.5 * 60;
|
||||
consensus.nPowAllowMinDifficultyBlocksFromHeight = 0;
|
||||
consensus.nPowAllowMinDifficultyBlocksAfterHeight = 0;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002;
|
||||
consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight =
|
||||
Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
|
||||
|
|
|
@ -93,7 +93,7 @@ struct Params {
|
|||
NetworkUpgrade vUpgrades[MAX_NETWORK_UPGRADES];
|
||||
/** Proof of work parameters */
|
||||
uint256 powLimit;
|
||||
boost::optional<uint32_t> nPowAllowMinDifficultyBlocksFromHeight;
|
||||
boost::optional<uint32_t> nPowAllowMinDifficultyBlocksAfterHeight;
|
||||
int64_t nPowAveragingWindow;
|
||||
int64_t nPowMaxAdjustDown;
|
||||
int64_t nPowMaxAdjustUp;
|
||||
|
|
|
@ -103,7 +103,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
|
|||
pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
|
||||
// Updating time can change work required on testnet:
|
||||
if (consensusParams.nPowAllowMinDifficultyBlocksFromHeight) {
|
||||
if (consensusParams.nPowAllowMinDifficultyBlocksAfterHeight) {
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams);
|
||||
}
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void static BitcoinMiner()
|
|||
// Update nNonce and nTime
|
||||
pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1);
|
||||
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
|
||||
if (chainparams.GetConsensus().nPowAllowMinDifficultyBlocksFromHeight)
|
||||
if (chainparams.GetConsensus().nPowAllowMinDifficultyBlocksAfterHeight)
|
||||
{
|
||||
// Changing pblock->nTime can change work required on testnet:
|
||||
hashTarget.SetCompact(pblock->nBits);
|
||||
|
|
|
@ -25,8 +25,10 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||
return nProofOfWorkLimit;
|
||||
|
||||
{
|
||||
if (params.nPowAllowMinDifficultyBlocksFromHeight &&
|
||||
pindexLast->nHeight >= params.nPowAllowMinDifficultyBlocksFromHeight.get())
|
||||
// Comparing to pindexLast->nHeight with >= because this function
|
||||
// returns the work required for the block after pindexLast.
|
||||
if (params.nPowAllowMinDifficultyBlocksAfterHeight &&
|
||||
pindexLast->nHeight >= params.nPowAllowMinDifficultyBlocksAfterHeight.get())
|
||||
{
|
||||
// Special difficulty rule for testnet:
|
||||
// If the new block's timestamp is more than 6 * 2.5 minutes
|
||||
|
|
Loading…
Reference in New Issue