diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-12 16:39:46 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-12 16:39:46 +0000 |
commit | 9b1b1a06a14ec30852c3a51d3d3808ce9fcaabac (patch) | |
tree | f63b8e2a0c8b1ef38f76fa9668848ce4073e416f /src | |
parent | 7543a5611ba78220f17f02306e5d274cb3cf00d3 (diff) | |
parent | ae8ccfd24bad9b0b08c431c7d446566b5fc3e661 (diff) | |
download | bitcoin-9b1b1a06a14ec30852c3a51d3d3808ce9fcaabac.tar.xz |
Merge branch '0.4.x' into 0.5.x
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoinrpc.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 55ad1198ff..60852a2729 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1660,8 +1660,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 @@ -1669,6 +1674,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 |