|
|
@ -3447,12 +3447,13 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) |
|
|
|
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime) |
|
|
|
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Update nExtraNonce
|
|
|
|
// Update nExtraNonce
|
|
|
|
int64 nNow = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); |
|
|
|
static uint256 hashPrevBlock; |
|
|
|
if (++nExtraNonce >= 0x7f && nNow > nPrevTime+15) |
|
|
|
if (hashPrevBlock != pblock->hashPrevBlock) |
|
|
|
{ |
|
|
|
{ |
|
|
|
nExtraNonce = 1; |
|
|
|
nExtraNonce = 0; |
|
|
|
nPrevTime = nNow; |
|
|
|
hashPrevBlock = pblock->hashPrevBlock; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
++nExtraNonce; |
|
|
|
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce); |
|
|
|
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce); |
|
|
|
pblock->hashMerkleRoot = pblock->BuildMerkleTree(); |
|
|
|
pblock->hashMerkleRoot = pblock->BuildMerkleTree(); |
|
|
|
} |
|
|
|
} |
|
|
|