C surgeons required
// First version of eToken
// Diff retarget was to high.
static const int64 nTargetTimespan = 7 * 24 * 60 * 60; // eToken: 7d
static const int64 nTargetSpacing = 120; // eToken: 2 minute
static const int64 nInterval = nTargetTimespan / nTargetSpacing;
// New rules 'A' starting on block nRulesAHeight.
// The nTargetSpacing remain the same.
static const int64 nRulesAHeight = 42218;
static const int64 nATargetTimespan = 48 * 60; // 48min - 24 blocks
static const int64 nAInterval = nATargetTimespan / nTargetSpacing;
static const int64 nAdjustDiffMaxUp = 2;
static const int64 nAdjustDiffMaxDown = 4;
//
// minimum amount of work that could possibly be required nTime after
// minimum work required was nBase
//
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
{
// Testnet has min-difficulty blocks
// after nTargetSpacing*2 time between blocks:
if (fTestNet && nTime > nTargetSpacing*2)
return bnProofOfWorkLimit.GetCompact();
CBigNum bnResult;
bnResult.SetCompact(nBase);
while (nTime > 0 && bnResult < bnProofOfWorkLimit)
{
bnResult *= nAdjustDiffMaxDown;
nTime -= nATargetTimespan*nAdjustDiffMaxDown;
}
if (bnResult > bnProofOfWorkLimit)
bnResult = bnProofOfWorkLimit;
return bnResult.GetCompact();
}