From b354251f1aa2e98585de0942d1fb4f1ec599a39b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 9 May 2012 17:02:07 +0000 Subject: [PATCH 1/7] 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 113de85a9db..a579a5d905a 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 5d53f48acbbba0ac80e8a26545a3ecaf8d139356 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 9 May 2012 17:08:39 +0000 Subject: [PATCH 2/7] Bugfix: getmemorypool: NULL pindexPrev across CreateNewBlock, in case it fails --- src/bitcoinrpc.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 05913cd0ffb..d8d65e7f426 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1760,16 +1760,26 @@ Value getmemorypool(const Array& params, bool fHelp) if (pindexPrev != pindexBest || (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 5)) { + // Clear pindexPrev so future calls 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 if(pblock) + { delete pblock; + pblock = NULL; + } pblock = CreateNewBlock(reservekey); if (!pblock) throw JSONRPCError(-7, "Out of memory"); + + // 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 3/7] 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 664a1747366..00e24e78195 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 52d876d82b3..c02c92e06bc 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 e608c25f066..66f548fc464 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 1168de7b70a..671ec3e7198 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 From b8dcb38b4ec674282a730c0eef214794502d9f4e Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 23 Jul 2012 11:59:02 +0800 Subject: [PATCH 4/7] Fix Typo --- src/qt/bitcoin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 6986d39cbf2..6debec703ad 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -130,7 +130,7 @@ std::string _(const char* psz) static void handleRunawayException(std::exception *e) { PrintExceptionContinue(e, "Runaway exception"); - QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occured. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); + QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); exit(1); } From 895191b9a8b2e80e2462b98329652f0e97c40322 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 23 Jul 2012 12:03:48 +0800 Subject: [PATCH 5/7] Typo --- src/qt/guiutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 7e2b006d929..ef57e017b43 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -28,7 +28,7 @@ public: static void setupAddressWidget(QLineEdit *widget, QWidget *parent); static void setupAmountWidget(QLineEdit *widget, QWidget *parent); - // Parse "bitcoin:" URI into recipient object, return true on succesful parsing + // Parse "bitcoin:" URI into recipient object, return true on successful parsing // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 static bool parseBitcoinURI(const QUrl *, SendCoinsRecipient *out); static bool parseBitcoinURI(QString uri, SendCoinsRecipient *out); From 0a9972bf1bb7878268fc84ea3794dfddf5b170cb Mon Sep 17 00:00:00 2001 From: Stephane Glondu Date: Tue, 24 Jul 2012 10:20:25 +0200 Subject: [PATCH 6/7] Fix spelling of successfully --- src/qt/askpassphrasedialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index 31e4040d1d2..e96f41941cf 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -158,7 +158,7 @@ void AskPassphraseDialog::accept() if(model->changePassphrase(oldpass, newpass1)) { QMessageBox::information(this, tr("Wallet encrypted"), - tr("Wallet passphrase was succesfully changed.")); + tr("Wallet passphrase was successfully changed.")); QDialog::accept(); // Success } else From 7543a5611ba78220f17f02306e5d274cb3cf00d3 Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Thu, 26 Jul 2012 10:07:43 +0800 Subject: [PATCH 7/7] Typo --- src/qt/sendcoinsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index ef2f1c31869..b27efc24b7b 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -115,7 +115,7 @@ void SendCoinsDialog::on_sendButton_clicked() { case WalletModel::InvalidAddress: QMessageBox::warning(this, tr("Send Coins"), - tr("The recepient address is not valid, please recheck."), + tr("The recipient address is not valid, please recheck."), QMessageBox::Ok, QMessageBox::Ok); break; case WalletModel::InvalidAmount: