]> Git Repo - VerusCoin.git/commitdiff
Merge branch 'bugfix_CNBerr_daggy' into bugfix_CNBerr
authorLuke Dashjr <[email protected]>
Wed, 9 May 2012 17:14:08 +0000 (17:14 +0000)
committerLuke Dashjr <[email protected]>
Wed, 9 May 2012 17:14:08 +0000 (17:14 +0000)
Conflicts:
rpc.cpp

src/bitcoinrpc.cpp

index 31ef725d793838aa26d019d6f1906c67d8702d8c..05913cd0ffbf72e56e6cf719a5bcb39f39eae534 100644 (file)
@@ -1656,8 +1656,13 @@ Value getwork(const Array& params, bool fHelp)
                     delete pblock;
                 vNewBlock.clear();
             }
+
+            // Clear pindexPrev so future getworks make a new block, despite any failures from here on
+            pindexPrev = NULL;
+
+            // Store the pindexBest used before CreateNewBlock, to avoid races
             nTransactionsUpdatedLast = nTransactionsUpdated;
-            pindexPrev = pindexBest;
+            CBlockIndex* pindexPrevNew = pindexBest;
             nStart = GetTime();
 
             // Create new block
@@ -1665,6 +1670,9 @@ Value getwork(const Array& params, bool fHelp)
             if (!pblock)
                 throw JSONRPCError(-7, "Out of memory");
             vNewBlock.push_back(pblock);
+
+            // Need to update only after we know CreateNewBlock succeeded
+            pindexPrev = pindexPrevNew;
         }
 
         // Update nTime
This page took 0.03042 seconds and 4 git commands to generate.