mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
Update nTime after nExtraNonce to avoid potential race
(extraNonce being reset due to just-occurred time change after nTime is set)
This commit is contained in:
parent
64ad448adc
commit
3a8029f033
8
rpc.cpp
8
rpc.cpp
@ -1330,15 +1330,15 @@ Value getwork(const Array& params, bool fHelp)
|
||||
vNewBlock.push_back(pblock);
|
||||
}
|
||||
|
||||
// Update nTime
|
||||
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
pblock->nNonce = 0;
|
||||
|
||||
// Update nExtraNonce
|
||||
static unsigned int nExtraNonce = 0;
|
||||
static int64 nPrevTime = 0;
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, nPrevTime);
|
||||
|
||||
// Update nTime
|
||||
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
pblock->nNonce = 0;
|
||||
|
||||
// Save
|
||||
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user