diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-12 16:39:03 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-12 16:39:03 +0000 |
commit | ae8ccfd24bad9b0b08c431c7d446566b5fc3e661 (patch) | |
tree | ecdaabf42162b3d4ef6fadf79f921e30148d3190 /src | |
parent | fb4dbbd188b68c4374c48dba5e481a35e920a6bf (diff) | |
parent | b354251f1aa2e98585de0942d1fb4f1ec599a39b (diff) | |
download | bitcoin-ae8ccfd24bad9b0b08c431c7d446566b5fc3e661.tar.xz |
Merge branch 'bugfix_CNBerr_daggy' into 0.4.x
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp index 786bf2987a..7f90574874 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -1550,8 +1550,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 @@ -1559,6 +1564,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 |