1

the standard values

    if (nActualTimespan < params.nPowTargetTimespan/4)
        nActualTimespan = params.nPowTargetTimespan/4;
    if (nActualTimespan > params.nPowTargetTimespan*4)
        nActualTimespan = params.nPowTargetTimespan*4;

but if i use

        if (nActualTimespan < params.nPowTargetTimespan/4)
            nActualTimespan = params.nPowTargetTimespan/4;
        if (nActualTimespan > params.nPowTargetTimespan*2)
            nActualTimespan = params.nPowTargetTimespan*2;

It's be valid or it's can broke diff system ?

What values can i add for diff is not grow very quickly, but drop faster than grow for it be more stable for fast block time.

setting of block time is

consensus.nPowTargetTimespan = 10 * 60; // 10 min
consensus.nPowTargetSpacing = 5 * 60; //5 min

And another question

I try use the exist function low diff block what created for testnet for only block with Height 2001 . Previous exist block is 2000 and latest now in blockchain.

if ((pindexLast->nHeight+1) % params.DifficultyAdjustmentInterval() != 0)
{
    if(pindexLast->nHeight+1 == 2001)
    {
        // Special difficulty rule for testnet:
        // If the new block's timestamp is more than 2* 10 minutes
        // then allow mining of a min-difficulty block.
        if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
            return nProofOfWorkLimit;
        else
        {
            // Return the last non-special-min-difficulty-rules-block
            const CBlockIndex* pindex = pindexLast;
            while (pindex->pprev && pindex->nHeight % params.DifficultyAdjustmentInterval() != 0 && pindex->nBits == nProofOfWorkLimit)
                pindex = pindex->pprev;
            return pindex->nBits;
        }
    }
    return pindexLast->nBits;           
}
else
{           
    if (params.fPowAllowMinDifficultyBlocks)
    {
        // Special difficulty rule for testnet:
        // If the new block's timestamp is more than 2* 10 minutes
        // then allow mining of a min-difficulty block.
        if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
            return nProofOfWorkLimit;
        else
        {
            // Return the last non-special-min-difficulty-rules-block
            const CBlockIndex* pindex = pindexLast;
            while (pindex->pprev && pindex->nHeight % params.DifficultyAdjustmentInterval() != 0 && pindex->nBits == nProofOfWorkLimit)
                pindex = pindex->pprev;
            return pindex->nBits;
        }
    }
    return pindexLast->nBits;
}

And use new rule retarget for new block's after 2001 and accept old block with old retarget rule.

   if(pindexLast->nHeight+1 > 2001)
    {
        if (nActualTimespan < params.nPowTargetTimespan/4)
            nActualTimespan = params.nPowTargetTimespan/4;
        if (nActualTimespan > params.nPowTargetTimespan*2)
            nActualTimespan = params.nPowTargetTimespan*2;
    }
    else
    {
        if (nActualTimespan < params.nPowTargetTimespan/4)
            nActualTimespan = params.nPowTargetTimespan/4;
        if (nActualTimespan > params.nPowTargetTimespan*4)
            nActualTimespan = params.nPowTargetTimespan*4;
    }

About what i asking , is this solution is right and it will work, or this solution is wrong end exist another way to do this ?

0
    if (nActualTimespan < params.nPowTargetTimespan/4)
        nActualTimespan = params.nPowTargetTimespan/4;
    if (nActualTimespan > params.nPowTargetTimespan*2)
        nActualTimespan = params.nPowTargetTimespan*2;

This does the opposite of what you want. It increases the difficulty quickly, but decreases the difficulty slowly.

Here's what you meant to do:

    if (nActualTimespan < params.nPowTargetTimespan/2)
        nActualTimespan = params.nPowTargetTimespan/2;
    if (nActualTimespan > params.nPowTargetTimespan*4)
        nActualTimespan = params.nPowTargetTimespan*4;
  • what parameters need to use for decrees it quickly , but increase slowly . End exit any alternative method to add on blockchain - mine block with low diff for reset diff for new block's ? – mraksoll Aug 8 '17 at 1:33
  • I do not understand if it's only for increase , where the decrease setting's ??? I think it's rule with /4 it's for decrease end rule with* for increase :/ – mraksoll Aug 8 '17 at 2:00
  • The code you posted caps the measured timespan at one fourth target, or twice the target. This limits the difficulty change in one retarget period to increasing by a factor of 4, or decreasing by a factor of 2. – Nick ODell Aug 8 '17 at 2:02
  • I need use /2 /2 *4 *4 or it's again wrong ? You can make little example with any setting how it be correct :/ Or for decrease x4 end increase only x2 – mraksoll Aug 8 '17 at 2:06
  • See edit I added. – Nick ODell Aug 8 '17 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.