diff options
| author | Luke Dashjr <[email protected]> | 2011-09-06 16:43:32 -0400 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2011-09-06 16:43:32 -0400 |
| commit | b760e254584a85db7195a4b1a67731a8cc12f9ed (patch) | |
| tree | 38de6d2be604a3212a39b460649511555f771cf1 /src/main.cpp | |
| parent | CHECKMULTISIG unit tests. (diff) | |
| parent | Reset extraNonce only when prevBlock changes, so miners can continue updating... (diff) | |
| download | discoin-b760e254584a85db7195a4b1a67731a8cc12f9ed.tar.xz discoin-b760e254584a85db7195a4b1a67731a8cc12f9ed.zip | |
Merge branch 'getwork_dedupe' into unique_coinbase
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index f48331206..480d2d8bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2797,12 +2797,13 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime) { // Update nExtraNonce - int64 nNow = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); - if (++nExtraNonce >= 0x7f && nNow > nPrevTime+1) + static uint256 hashPrevBlock; + if (hashPrevBlock != pblock->hashPrevBlock) { - nExtraNonce = 1; - nPrevTime = nNow; + nExtraNonce = 0; + hashPrevBlock = pblock->hashPrevBlock; } + ++nExtraNonce; pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce); pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } |