Bitcoin Forum
June 03, 2024, 04:27:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: Need Help Updating Current Code - Kind Developers Give me a Hand  (Read 382 times)
itos (OP)
Full Member
***
Offline Offline

Activity: 560
Merit: 105



View Profile
February 05, 2014, 01:25:51 AM
 #1

Any kind developer that could give a hand? I am updating a client for a coin I think I got it right. But I want any experienced developer help me on this. I also added some checkpoints for the new wallet.

I want to change the retarget the difficulty from 960 blocks (1 day) to 40 blocks (1 hours) of a coin.

Code:
static int64 nTargetTimespan = 1 * 24 * 60 * 60; // 1 day
static int64 nTargetSpacing = 90; // 1.5 minute blocks
static int64 nInterval = nTargetTimespan / nTargetSpacing;
static int64 nReTargetHistoryFact = 4; // look at 4 times the retarget interval into block history

Code:
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
{
    unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();

    // Genesis block
    if (pindexLast == NULL)
        return nProofOfWorkLimit;

    // From block 28000 reassess the difficulty every 40 blocks
// Reduce Retarget factor to 2
    if(pindexLast->nHeight >= 28000)
    {
        nTargetTimespan = 60 * 60; // 1 hours
        nTargetSpacing = 1.5 * 60; // 1.5 minutes
        nInterval = nTargetTimespan / nTargetSpacing;
nReTargetHistoryFact = 2;
    }
else
{
nTargetTimespan = 1 * 24 * 60 * 60; // 1 day
nTargetSpacing = 1.5 * 60; // 1.5 minutes
nInterval = nTargetTimespan / nTargetSpacing;
nReTargetHistoryFact = 4;
}

What do you think? This code will trigger a change in difficulty upon block 28000? Or do I need to do more stuff?

I appreciate any help.

Best wishes,

itos
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!