aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <[email protected]>2011-05-11 16:50:14 -0400
committerLuke Dashjr <[email protected]>2011-05-11 16:50:18 -0400
commit3a8029f0335dbdb039eccb7bddc88fb0cd1ff971 (patch)
treecbc16005e90290d3eb60fcbcf79507ef9124463a
parentBetter wording for transaction fee notification messages (diff)
downloaddiscoin-3a8029f0335dbdb039eccb7bddc88fb0cd1ff971.tar.xz
discoin-3a8029f0335dbdb039eccb7bddc88fb0cd1ff971.zip
Update nTime after nExtraNonce to avoid potential race
(extraNonce being reset due to just-occurred time change after nTime is set)
-rw-r--r--rpc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/rpc.cpp b/rpc.cpp
index 90e7f15a9..2175dddb4 100644
--- a/rpc.cpp
+++ b/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);