mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation.
This commit is contained in:
parent
5f5ee0f3ce
commit
7801f4387d
@ -76,6 +76,7 @@ public:
|
|||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
consensus.fPowAllowMinDifficultyBlocks = false;
|
consensus.fPowAllowMinDifficultyBlocks = false;
|
||||||
|
consensus.fPowNoRetargeting = false;
|
||||||
/**
|
/**
|
||||||
* The message start string is designed to be unlikely to occur in normal data.
|
* The message start string is designed to be unlikely to occur in normal data.
|
||||||
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
|
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
|
||||||
@ -155,6 +156,7 @@ public:
|
|||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||||
|
consensus.fPowNoRetargeting = false;
|
||||||
pchMessageStart[0] = 0x0b;
|
pchMessageStart[0] = 0x0b;
|
||||||
pchMessageStart[1] = 0x11;
|
pchMessageStart[1] = 0x11;
|
||||||
pchMessageStart[2] = 0x09;
|
pchMessageStart[2] = 0x09;
|
||||||
@ -217,6 +219,7 @@ public:
|
|||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||||
|
consensus.fPowNoRetargeting = true;
|
||||||
|
|
||||||
pchMessageStart[0] = 0xfa;
|
pchMessageStart[0] = 0xfa;
|
||||||
pchMessageStart[1] = 0xbf;
|
pchMessageStart[1] = 0xbf;
|
||||||
|
@ -22,6 +22,7 @@ struct Params {
|
|||||||
/** Proof of work parameters */
|
/** Proof of work parameters */
|
||||||
uint256 powLimit;
|
uint256 powLimit;
|
||||||
bool fPowAllowMinDifficultyBlocks;
|
bool fPowAllowMinDifficultyBlocks;
|
||||||
|
bool fPowNoRetargeting;
|
||||||
int64_t nPowTargetSpacing;
|
int64_t nPowTargetSpacing;
|
||||||
int64_t nPowTargetTimespan;
|
int64_t nPowTargetTimespan;
|
||||||
int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
|
int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
|
||||||
|
@ -52,6 +52,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||||||
|
|
||||||
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
|
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
|
||||||
{
|
{
|
||||||
|
if (params.fPowNoRetargeting)
|
||||||
|
return pindexLast->nBits;
|
||||||
|
|
||||||
// Limit adjustment step
|
// Limit adjustment step
|
||||||
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
|
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
|
||||||
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
|
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
|
||||||
|
Loading…
Reference in New Issue
Block a user