mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge branch 'getwork_dedupe' into unique_coinbase
This commit is contained in:
commit
b760e25458
@ -2797,12 +2797,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+1)
|
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();
|
||||||
}
|
}
|
||||||
|
@ -1614,15 +1614,15 @@ Value getwork(const Array& params, bool fHelp)
|
|||||||
vNewBlock.push_back(pblock);
|
vNewBlock.push_back(pblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update nTime
|
|
||||||
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
|
||||||
pblock->nNonce = 0;
|
|
||||||
|
|
||||||
// Update nExtraNonce
|
// Update nExtraNonce
|
||||||
static unsigned int nExtraNonce = 0;
|
static unsigned int nExtraNonce = 0;
|
||||||
static int64 nPrevTime = 0;
|
static int64 nPrevTime = 0;
|
||||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, nPrevTime);
|
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, nPrevTime);
|
||||||
|
|
||||||
|
// Update nTime
|
||||||
|
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||||
|
pblock->nNonce = 0;
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
|
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user