Implement new difficulty algorithm (#931)
The algorithm is based on DigiShield v3/v4.
This commit is contained in:
@@ -36,9 +36,13 @@ struct Params {
|
||||
/** Proof of work parameters */
|
||||
uint256 powLimit;
|
||||
bool fPowAllowMinDifficultyBlocks;
|
||||
int64_t nPowAveragingWindow;
|
||||
int64_t nPowMaxAdjustDown;
|
||||
int64_t nPowMaxAdjustUp;
|
||||
int64_t nPowTargetSpacing;
|
||||
int64_t nPowTargetTimespan;
|
||||
int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
|
||||
int64_t AveragingWindowTimespan() const { return nPowAveragingWindow * nPowTargetSpacing; }
|
||||
int64_t MinActualTimespan() const { return (AveragingWindowTimespan() * (100 - nPowMaxAdjustUp )) / 100; }
|
||||
int64_t MaxActualTimespan() const { return (AveragingWindowTimespan() * (100 + nPowMaxAdjustDown)) / 100; }
|
||||
};
|
||||
} // namespace Consensus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user