From b354251f1aa2e98585de0942d1fb4f1ec599a39b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 9 May 2012 17:02:07 +0000 Subject: [PATCH 1/2] Bugfix: getwork: NULL pindexPrev across CreateNewBlock, in case it fails --- rpc.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpc.cpp b/rpc.cpp index 113de85a..a579a5d9 100644 --- a/rpc.cpp +++ b/rpc.cpp @@ -967,8 +967,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 @@ -976,6 +981,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 From fb4dbbd188b68c4374c48dba5e481a35e920a6bf Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 18 Jul 2012 22:11:56 +0800 Subject: [PATCH 2/2] Docs Tidy up (PARTIAL cherry pick) --- doc/README | 2 +- doc/build-osx.txt | 2 +- doc/build-unix.txt | 2 +- doc/unit-tests.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/README b/doc/README index 664a1747..00e24e78 100644 --- a/doc/README +++ b/doc/README @@ -2,7 +2,7 @@ Bitcoin 0.4.7 BETA Copyright (c) 2009-2012 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying -file license.txt or http://www.opensource.org/licenses/mit-license.php. +file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). diff --git a/doc/build-osx.txt b/doc/build-osx.txt index 52d876d8..c02c92e0 100644 --- a/doc/build-osx.txt +++ b/doc/build-osx.txt @@ -1,7 +1,7 @@ Copyright (c) 2010 Laszlo Hanyecz Portions Copyright (c) 2011 Douglas Huff Distributed under the MIT/X11 software license, see the accompanying file -license.txt or http://www.opensource.org/licenses/mit-license.php. This +COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by diff --git a/doc/build-unix.txt b/doc/build-unix.txt index e608c25f..66f548fc 100644 --- a/doc/build-unix.txt +++ b/doc/build-unix.txt @@ -1,6 +1,6 @@ Copyright (c) 2009-2010 Satoshi Nakamoto Distributed under the MIT/X11 software license, see the accompanying -file license.txt or http://www.opensource.org/licenses/mit-license.php. +file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP diff --git a/doc/unit-tests.txt b/doc/unit-tests.txt index 1168de7b..671ec3e7 100644 --- a/doc/unit-tests.txt +++ b/doc/unit-tests.txt @@ -1,4 +1,4 @@ -Compiling/runing bitcoind unit tests +Compiling/running bitcoind unit tests ------------------------------------ bitcoind unit tests are in the src/test/ directory; they