From 3a8029f0335dbdb039eccb7bddc88fb0cd1ff971 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 11 May 2011 16:50:14 -0400 Subject: [PATCH] Update nTime after nExtraNonce to avoid potential race (extraNonce being reset due to just-occurred time change after nTime is set) --- rpc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpc.cpp b/rpc.cpp index 90e7f15a91..2175dddb4b 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);