Skip to content

Commit

Permalink
modification to nHashDrift calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
presstab committed Feb 12, 2015
1 parent c71b7a3 commit be434ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/kernel.cpp
Expand Up @@ -367,15 +367,14 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned
return stakeTargetHit(hashProofOfStake, (int64)nTimeTx - nTxPrevTime, nValueIn, bnTargetPerCoinDay);
}

nHashDrift = min(nHashDrift, (unsigned int)(5*60)); // only allow 5 minutes of hashing in the future
nHashDrift *= 2; // double the value to hash equally into the past
nHashDrift = min(nHashDrift, (unsigned int)(10*60)); // only allow 10 minutes of hashing in the future
bool fSuccess = false;
unsigned int nTryTime = 0;
unsigned int i;
for(i = 0; i < nHashDrift; i++) //iterate the hashing
for(i = 0; i < (nHashDrift*2); i++) //iterate the hashing
{
//hash this iteration
nTryTime = nTimeTx + (nHashDrift/2) - i;
nTryTime = nTimeTx - nHashDrift + i;
hashProofOfStake = stakeHash(nTryTime, nTxPrevTime, ss, prevout.n, nTxPrevOffset, nTimeBlockFrom);

// if stake hash does not meet the target then continue to next iteration
Expand Down

0 comments on commit be434ee

Please sign in to comment.