From 20cff2ade4d686fb4f10c106dbc99b76c173102a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 1 Oct 2011 02:47:47 +0200 Subject: [PATCH 01/21] remove possibility of 63 bit overflow in ParseMoney --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index 76a27002719..d6a113095da 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -389,7 +389,7 @@ bool ParseMoney(const char* pszIn, int64& nRet) for (; *p; p++) if (!isspace(*p)) return false; - if (strWhole.size() > 14) + if (strWhole.size() > 10) // guard against 63 bit overflow return false; if (nUnits < 0 || nUnits > COIN) return false; From 600dc6255971bfe152767c67e7ca6866fb1541ea Mon Sep 17 00:00:00 2001 From: Victor Leschuk Date: Thu, 6 Oct 2011 19:53:42 +0400 Subject: [PATCH 02/21] Fix for 64bit build --- src/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.h b/src/util.h index 3d7ef108b47..6ecc92b2b6d 100644 --- a/src/util.h +++ b/src/util.h @@ -662,8 +662,8 @@ inline bool AffinityBugWorkaround(void(*pfn)(void*)) { #ifdef __WXMSW__ // Sometimes after a few hours affinity gets stuck on one processor - DWORD dwProcessAffinityMask = -1; - DWORD dwSystemAffinityMask = -1; + DWORD_PTR dwProcessAffinityMask = -1; + DWORD_PTR dwSystemAffinityMask = -1; GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask); DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); From aec5c5fe26293452d3fe7acf1e4c20830613812c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 10 Oct 2011 14:22:31 -0400 Subject: [PATCH 03/21] Bump version to 0.4.1 --- contrib/Bitcoin.app/Contents/Info.plist | 2 +- doc/README | 2 +- doc/README_windows.txt | 2 +- share/setup.nsi | 6 +++--- src/serialize.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/Bitcoin.app/Contents/Info.plist b/contrib/Bitcoin.app/Contents/Info.plist index a5c7da1c8f4..d5a278a570c 100644 --- a/contrib/Bitcoin.app/Contents/Info.plist +++ b/contrib/Bitcoin.app/Contents/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4.00 + 0.4.1 CFBundleSignature ???? CFBundleVersion diff --git a/doc/README b/doc/README index 772fd7f31ec..789cc9fb870 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.4.0rc1 BETA +Bitcoin 0.4.1 BETA Copyright (c) 2009-2011 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 8378ae50d81..7ff8834920b 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.4.00rc1 BETA +Bitcoin 0.4.1 BETA Copyright (c) 2009-2011 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/share/setup.nsi b/share/setup.nsi index 6cf477747c8..4c837c974bf 100644 --- a/share/setup.nsi +++ b/share/setup.nsi @@ -5,7 +5,7 @@ SetCompressor /SOLID lzma # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define VERSION 0.4.00 +!define VERSION 0.4.1 !define COMPANY "Bitcoin project" !define URL http://www.bitcoin.org/ @@ -45,13 +45,13 @@ Var StartMenuGroup !insertmacro MUI_LANGUAGE English # Installer attributes -OutFile bitcoin-0.4.00-win32-setup.exe +OutFile bitcoin-0.4.1-win32-setup.exe InstallDir $PROGRAMFILES\Bitcoin CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion 0.4.00.0 +VIProductVersion 0.4.1.0 VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/src/serialize.h b/src/serialize.h index 698bdfe6a9d..320ce9d2ae0 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -59,7 +59,7 @@ class CDataStream; class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -static const int VERSION = 40000; +static const int VERSION = 40100; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; From b526cbaa718a6c66bc6b5bc224d2717e0066ddb6 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 10 Oct 2011 16:03:14 -0400 Subject: [PATCH 04/21] bitcoind does not need to link with gthread-2.0 --- src/makefile.unix | 1 - 1 file changed, 1 deletion(-) diff --git a/src/makefile.unix b/src/makefile.unix index 43c3ea7f500..98c40771d29 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -30,7 +30,6 @@ endif LIBS+= \ -Wl,-Bdynamic \ - -l gthread-2.0 \ -l z \ -l dl \ -l pthread From 38a976d5bbfb1bdb304ae64aa3ca992d13ad3cde Mon Sep 17 00:00:00 2001 From: cjdelisle Date: Sun, 16 Oct 2011 20:38:23 -0400 Subject: [PATCH 05/21] Added a workaround for an Ubuntu bug which causes -fstack-protector-all to be disregarded. --- src/makefile.unix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/makefile.unix b/src/makefile.unix index 98c40771d29..9e0b3263d7a 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -38,12 +38,17 @@ LIBS+= \ # Hardening # Make some classes of vulnerabilities unexploitable in case one is discovered. # + # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes + # -fstack-protector-all to be ignored unless -fno-stack-protector is used first. + # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722 + HARDENING=-fno-stack-protector + # Stack Canaries # Put numbers at the beginning of each stack frame and check that they are the same. # If a stack buffer if overflowed, it writes over the canary number and then on return # when that number is checked, it won't be the same and the program will exit with # a "Stack smashing detected" error instead of being exploited. - HARDENING=-fstack-protector-all -Wstack-protector + HARDENING+=-fstack-protector-all -Wstack-protector # Make some important things such as the global offset table read only as soon as # the dynamic linker is finished building it. This will prevent overwriting of addresses From ed176ba584ed9f05f5311743059e108ddbbb5d5b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 10 Oct 2011 12:08:05 -0400 Subject: [PATCH 06/21] Only define __STDC_LIMIT_MACROS if not already defined. --- src/headers.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/headers.h b/src/headers.h index d0c74348202..ab318cbb436 100644 --- a/src/headers.h +++ b/src/headers.h @@ -18,7 +18,13 @@ #endif #define _WIN32_IE 0x0400 #define WIN32_LEAN_AND_MEAN 1 + +// Include boost/foreach here as it defines __STDC_LIMIT_MACROS on some systems. +#include +#ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h +#endif + #if (defined(__unix__) || defined(unix)) && !defined(USG) #include // to get BSD define #endif @@ -57,8 +63,6 @@ #include #include -#include - #ifdef __WXMSW__ #include #include From ef4280e08b217bf2512bb1878e1dd2a926e557c9 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 10 Oct 2011 15:51:07 -0400 Subject: [PATCH 07/21] Add returns to avoid annoying compile-time warnings. --- src/keystore.h | 1 + src/wallet.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/keystore.h b/src/keystore.h index bbfac83d1f1..1f2c6aea3ea 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -114,6 +114,7 @@ public: return CBasicKeyStore::HaveKey(address); return mapCryptedKeys.count(address) > 0; } + return false; } bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const; bool GetPubKey(const CBitcoinAddress &address, std::vector& vchPubKeyOut) const; diff --git a/src/wallet.cpp b/src/wallet.cpp index 8bbb80cf254..298a2c64288 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -40,6 +40,7 @@ bool CWallet::AddCryptedKey(const vector &vchPubKey, const vector else return CWalletDB(strWalletFile).WriteCryptedKey(vchPubKey, vchCryptedSecret); } + return false; } bool CWallet::Unlock(const string& strWalletPassphrase) From 00eae584a26295dbf7b1aebf99c1b8a4c9a86c37 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 10 Nov 2011 21:29:23 +0100 Subject: [PATCH 08/21] Resilvering --- src/db.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/db.h | 5 ++- src/wallet.cpp | 10 ++++++ 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/db.cpp b/src/db.cpp index a22b17e34c2..d41da68abad 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -165,6 +165,90 @@ void static CloseDb(const string& strFile) } } +bool Resilver(const string& strFile) +{ + while (!fShutdown) + { + CRITICAL_BLOCK(cs_db) + { + if (!mapFileUseCount.count(strFile) || mapFileUseCount[strFile] == 0) + { + // Flush log data to the dat file + CloseDb(strFile); + dbenv.txn_checkpoint(0, 0, 0); + dbenv.lsn_reset(strFile.c_str(), 0); + mapFileUseCount.erase(strFile); + + bool fSuccess = true; + printf("Resilvering %s...\n", strFile.c_str()); + string strFileRes = strFile + ".resilver"; + CDB db(strFile.c_str(), "r"); + Db* pdbCopy = new Db(&dbenv, 0); + + int ret = pdbCopy->open(NULL, // Txn pointer + strFileRes.c_str(), // Filename + "main", // Logical db name + DB_BTREE, // Database type + DB_CREATE, // Flags + 0); + if (ret > 0) + { + printf("Cannot create database file %s\n", strFileRes.c_str()); + fSuccess = false; + } + + Dbc* pcursor = db.GetCursor(); + if (pcursor) + while (fSuccess) + { + CDataStream ssKey; + CDataStream ssValue; + int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); + if (ret == DB_NOTFOUND) + break; + else if (ret != 0) + { + pcursor->close(); + fSuccess = false; + break; + } + Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datValue(&ssValue[0], ssValue.size()); + int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); + if (ret2 > 0) + fSuccess = false; + } + if (fSuccess) + { + Db* pdb = mapDb[strFile]; + if (pdb->close(0)) + fSuccess = false; + if (pdbCopy->close(0)) + fSuccess = false; + delete pdb; + delete pdbCopy; + mapDb[strFile] = NULL; + } + if (fSuccess) + { + Db dbA(&dbenv, 0); + if (dbA.remove(strFile.c_str(), NULL, 0)) + fSuccess = false; + Db dbB(&dbenv, 0); + if (dbB.rename(strFileRes.c_str(), NULL, strFile.c_str(), 0)) + fSuccess = false; + } + if (!fSuccess) + printf("Resilvering of %s FAILED!\n", strFileRes.c_str()); + return fSuccess; + } + } + Sleep(100); + } + return false; +} + + void DBFlush(bool fShutdown) { // Flush log data to the actual data file @@ -674,6 +758,8 @@ int CWalletDB::LoadWallet(CWallet* pwallet) pwallet->vchDefaultKey.clear(); int nFileVersion = 0; vector vWalletUpgrade; + bool fIsResilvered = false; + bool fIsEncrypted = false; // Modify defaults #ifndef __WXMSW__ @@ -799,6 +885,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet) ssValue >> vchPrivKey; if (!pwallet->LoadCryptedKey(vchPubKey, vchPrivKey)) return DB_CORRUPT; + fIsEncrypted = true; } else if (strType == "defaultkey") { @@ -832,6 +919,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet) if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose; if (strKey == "fUseProxy") ssValue >> fUseProxy; if (strKey == "addrProxy") ssValue >> addrProxy; + if (strKey == "fIsResilvered") ssValue >> fIsResilvered; if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP; } else if (strType == "minversion") @@ -869,6 +957,8 @@ int CWalletDB::LoadWallet(CWallet* pwallet) WriteVersion(VERSION); } + if (fIsEncrypted && !fIsResilvered) + return DB_NEED_RESILVER; return DB_LOAD_OK; } diff --git a/src/db.h b/src/db.h index 73ea1902ccf..75748ace01b 100644 --- a/src/db.h +++ b/src/db.h @@ -32,7 +32,7 @@ extern DbEnv dbenv; extern void DBFlush(bool fShutdown); void ThreadFlushWalletDB(void* parg); bool BackupWallet(const CWallet& wallet, const std::string& strDest); - +extern bool Resilver(const std::string& strFile); @@ -257,6 +257,8 @@ public: { return Write(std::string("version"), nVersion); } + + friend bool Resilver(const std::string&); }; @@ -349,6 +351,7 @@ enum DBErrors DB_CORRUPT, DB_TOO_NEW, DB_LOAD_FAIL, + DB_NEED_RESILVER }; class CWalletDB : public CDB diff --git a/src/wallet.cpp b/src/wallet.cpp index 298a2c64288..924700d0276 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -190,6 +190,9 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase) Lock(); } + if (Resilver(strWalletFile)) + CWalletDB(strWalletFile, "r+").WriteSetting("fIsResilvered", true); + return true; } @@ -1122,6 +1125,13 @@ int CWallet::LoadWallet(bool& fFirstRunRet) return false; fFirstRunRet = false; int nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); + if (nLoadWalletRet == DB_NEED_RESILVER) + { + if (Resilver(strWalletFile)) + CWalletDB(strWalletFile, "r+").WriteSetting("fIsResilvered", true); + nLoadWalletRet = DB_LOAD_OK; + } + if (nLoadWalletRet != DB_LOAD_OK) return nLoadWalletRet; fFirstRunRet = vchDefaultKey.empty(); From 2744ea8c1fbc2e1ef6b1824a21fd2a75e2b6dbc4 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 10 Nov 2011 21:12:46 -0500 Subject: [PATCH 09/21] Obsolete keypool and make sure database removes log files on shutdown. --- src/db.cpp | 70 +++++++++++++++++++++++++++++++++++-------------- src/db.h | 7 +++-- src/init.cpp | 14 +++++++--- src/rpc.cpp | 11 +++++++- src/serialize.h | 2 +- src/wallet.cpp | 21 ++++++++++----- 6 files changed, 89 insertions(+), 36 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index d41da68abad..1a1289f8d10 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -28,6 +28,34 @@ DbEnv dbenv(0); static map mapFileUseCount; static map mapDb; +static void EnvShutdown(bool fRemoveLogFiles) +{ + if (!fDbEnvInit) + return; + + fDbEnvInit = false; + dbenv.close(0); + DbEnv(0).remove(GetDataDir().c_str(), 0); + + if (fRemoveLogFiles) + { + filesystem::path datadir(GetDataDir()); + filesystem::directory_iterator it(datadir / "database"); + while (it != filesystem::directory_iterator()) + { + const filesystem::path& p = it->path(); +#if BOOST_FILESYSTEM_VERSION == 2 + std::string f = p.filename(); +#else + std::string f = p.filename().generic_string(); +#endif + if (f.find("log.") == 0) + filesystem::remove(p); + ++it; + } + } +} + class CDBInit { public: @@ -36,11 +64,7 @@ public: } ~CDBInit() { - if (fDbEnvInit) - { - dbenv.close(0); - fDbEnvInit = false; - } + EnvShutdown(false); } } instance_of_cdbinit; @@ -165,7 +189,7 @@ void static CloseDb(const string& strFile) } } -bool Resilver(const string& strFile) +bool CDB::Rewrite(const string& strFile, const char* pszSkip) { while (!fShutdown) { @@ -180,8 +204,8 @@ bool Resilver(const string& strFile) mapFileUseCount.erase(strFile); bool fSuccess = true; - printf("Resilvering %s...\n", strFile.c_str()); - string strFileRes = strFile + ".resilver"; + printf("Rewriting %s...\n", strFile.c_str()); + string strFileRes = strFile + ".rewrite"; CDB db(strFile.c_str(), "r"); Db* pdbCopy = new Db(&dbenv, 0); @@ -212,6 +236,15 @@ bool Resilver(const string& strFile) fSuccess = false; break; } + if (pszSkip && + strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) + continue; + if (strncmp(&ssKey[0], "\x07version", 8) == 0) + { + // Update version: + ssValue.clear(); + ssValue << VERSION; + } Dbt datKey(&ssKey[0], ssKey.size()); Dbt datValue(&ssValue[0], ssValue.size()); int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); @@ -239,7 +272,7 @@ bool Resilver(const string& strFile) fSuccess = false; } if (!fSuccess) - printf("Resilvering of %s FAILED!\n", strFileRes.c_str()); + printf("Rewriting of %s FAILED!\n", strFileRes.c_str()); return fSuccess; } } @@ -249,7 +282,7 @@ bool Resilver(const string& strFile) } -void DBFlush(bool fShutdown) +void DBFlush(bool fShutdown, bool fRemoveLogFiles) { // Flush log data to the actual data file // on all files that are not in use @@ -280,9 +313,10 @@ void DBFlush(bool fShutdown) { char** listp; if (mapFileUseCount.empty()) + { dbenv.log_archive(&listp, DB_ARCH_REMOVE); - dbenv.close(0); - fDbEnvInit = false; + EnvShutdown(fRemoveLogFiles); + } } } } @@ -758,7 +792,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet) pwallet->vchDefaultKey.clear(); int nFileVersion = 0; vector vWalletUpgrade; - bool fIsResilvered = false; bool fIsEncrypted = false; // Modify defaults @@ -919,7 +952,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet) if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose; if (strKey == "fUseProxy") ssValue >> fUseProxy; if (strKey == "addrProxy") ssValue >> addrProxy; - if (strKey == "fIsResilvered") ssValue >> fIsResilvered; if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP; } else if (strType == "minversion") @@ -947,8 +979,11 @@ int CWalletDB::LoadWallet(CWallet* pwallet) printf("fUseUPnP = %d\n", fUseUPnP); - // Upgrade - if (nFileVersion < VERSION) + // Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: + if (fIsEncrypted && (nFileVersion == 40000 || nFileVersion == 50000)) + return DB_NEED_REWRITE; + + if (nFileVersion < VERSION) // Update { // Get rid of old debug.log file in current directory if (nFileVersion <= 105 && !pszSetDataDir[0]) @@ -957,9 +992,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet) WriteVersion(VERSION); } - if (fIsEncrypted && !fIsResilvered) - return DB_NEED_RESILVER; - return DB_LOAD_OK; } diff --git a/src/db.h b/src/db.h index 75748ace01b..98af4be9a0e 100644 --- a/src/db.h +++ b/src/db.h @@ -29,10 +29,9 @@ extern unsigned int nWalletDBUpdated; extern DbEnv dbenv; -extern void DBFlush(bool fShutdown); +extern void DBFlush(bool fShutdown, bool fRemoveLogFiles); void ThreadFlushWalletDB(void* parg); bool BackupWallet(const CWallet& wallet, const std::string& strDest); -extern bool Resilver(const std::string& strFile); @@ -258,7 +257,7 @@ public: return Write(std::string("version"), nVersion); } - friend bool Resilver(const std::string&); + bool static Rewrite(const std::string& strFile, const char* pszSkip = NULL); }; @@ -351,7 +350,7 @@ enum DBErrors DB_CORRUPT, DB_TOO_NEW, DB_LOAD_FAIL, - DB_NEED_RESILVER + DB_NEED_REWRITE }; class CWalletDB : public CDB diff --git a/src/init.cpp b/src/init.cpp index dbc2c413322..4a149b31bf3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -34,8 +34,8 @@ void Shutdown(void* parg) { static CCriticalSection cs_Shutdown; static bool fTaken; - bool fFirstThread; - CRITICAL_BLOCK(cs_Shutdown) + bool fFirstThread = false; + TRY_CRITICAL_BLOCK(cs_Shutdown) { fFirstThread = !fTaken; fTaken = true; @@ -45,9 +45,9 @@ void Shutdown(void* parg) { fShutdown = true; nTransactionsUpdated++; - DBFlush(false); + DBFlush(false, false); StopNode(); - DBFlush(true); + DBFlush(true, true); boost::filesystem::remove(GetPidFile()); UnregisterWallet(pwalletMain); delete pwalletMain; @@ -396,6 +396,12 @@ bool AppInit2(int argc, char* argv[]) strErrors += _("Error loading wallet.dat: Wallet corrupted \n"); else if (nLoadWalletRet == DB_TOO_NEW) strErrors += _("Error loading wallet.dat: Wallet requires newer version of Bitcoin \n"); + else if (nLoadWalletRet == DB_NEED_REWRITE) + { + strErrors += _("Wallet needed to be rewritten: restart Bitcoin to complete \n"); + wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR); + return false; + } else strErrors += _("Error loading wallet.dat \n"); } diff --git a/src/rpc.cpp b/src/rpc.cpp index 885ffd1f2b7..a936edbbe47 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -1431,6 +1431,11 @@ Value encryptwallet(const Array& params, bool fHelp) if (pwalletMain->IsCrypted()) throw JSONRPCError(-15, "Error: running with an encrypted wallet, but encryptwallet was called."); +#ifdef GUI + // shutting down via RPC while the GUI is running does not work (yet): + throw runtime_error("Not Yet Implemented: use GUI to encrypt wallet, not RPC command"); +#endif + string strWalletPass; strWalletPass.reserve(100); mlock(&strWalletPass[0], strWalletPass.capacity()); @@ -1450,7 +1455,11 @@ Value encryptwallet(const Array& params, bool fHelp) fill(strWalletPass.begin(), strWalletPass.end(), '\0'); munlock(&strWalletPass[0], strWalletPass.capacity()); - return Value::null; + // BDB seems to have a bad habit of writing old data into + // slack space in .dat files; that is bad if the old data is + // unencrypted private keys. So: + CreateThread(Shutdown, NULL); + return "wallet encrypted; bitcoin server stopping, restart to run with encrypted wallet"; } diff --git a/src/serialize.h b/src/serialize.h index 320ce9d2ae0..c531d2a198e 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -59,7 +59,7 @@ class CDataStream; class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -static const int VERSION = 40100; +static const int VERSION = 40101; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; diff --git a/src/wallet.cpp b/src/wallet.cpp index 924700d0276..c004d183604 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -188,10 +188,12 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase) } Lock(); - } - if (Resilver(strWalletFile)) - CWalletDB(strWalletFile, "r+").WriteSetting("fIsResilvered", true); + // Need to completely rewrite the wallet file; if we don't, bdb might keep + // bits of the unencrypted private key in slack space in the database file. + setKeyPool.clear(); + CDB::Rewrite(strWalletFile, "\x04pool"); + } return true; } @@ -1125,11 +1127,16 @@ int CWallet::LoadWallet(bool& fFirstRunRet) return false; fFirstRunRet = false; int nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); - if (nLoadWalletRet == DB_NEED_RESILVER) + if (nLoadWalletRet == DB_NEED_REWRITE) { - if (Resilver(strWalletFile)) - CWalletDB(strWalletFile, "r+").WriteSetting("fIsResilvered", true); - nLoadWalletRet = DB_LOAD_OK; + if (CDB::Rewrite(strWalletFile, "\x04pool")) + { + setKeyPool.clear(); + // Note: can't top-up keypool here, because wallet is locked. + // User will be prompted to unlock wallet the next operation + // the requires a new key. + } + nLoadWalletRet = DB_NEED_REWRITE; } if (nLoadWalletRet != DB_LOAD_OK) From 0143c024af1e5b93dfc3a89e4e40be59a0f40f58 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 09:47:29 -0500 Subject: [PATCH 10/21] Fix boost filesystem incompatibility problem --- src/db.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 1a1289f8d10..b2bd7e2899c 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -44,10 +44,10 @@ static void EnvShutdown(bool fRemoveLogFiles) while (it != filesystem::directory_iterator()) { const filesystem::path& p = it->path(); -#if BOOST_FILESYSTEM_VERSION == 2 - std::string f = p.filename(); -#else +#if BOOST_FILESYSTEM_VERSION == 3 std::string f = p.filename().generic_string(); +#else + std::string f = p.filename(); #endif if (f.find("log.") == 0) filesystem::remove(p); From 1179f6373dfffdcb091576215cabe73c932df925 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 15 Nov 2011 10:33:26 -0500 Subject: [PATCH 11/21] Update gitian descriptors to point at stable git repo --- contrib/gitian-descriptors/gitian-win32.yml | 2 +- contrib/gitian-descriptors/gitian.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml index 52b10bc33fc..252e62e2369 100644 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -13,7 +13,7 @@ packages: - "wine" reference_datetime: "2011-01-30 00:00:00" remotes: -- "url": "https://github.com/bitcoin/bitcoin.git" +- "url": "https://git.gitorious.org/+bitcoin-stable-developers/bitcoin/bitcoind-stable.git" "dir": "bitcoin" files: - "wxwidgets-win32-2.9.2-gitian.zip" diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index efa9cb8c109..c29224402a7 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -15,7 +15,7 @@ packages: - "unzip" reference_datetime: "2011-01-30 00:00:00" remotes: -- "url": "https://github.com/bitcoin/bitcoin.git" +- "url": "https://git.gitorious.org/+bitcoin-stable-developers/bitcoin/bitcoind-stable.git" "dir": "bitcoin" files: - "wxWidgets-2.9.2-x64-gitian.zip" From 586ea168c2e29b9f96b07a3a5145356af11b4dce Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 15 Nov 2011 10:21:02 -0500 Subject: [PATCH 12/21] add message about restarting bitcoin after encrypting wallet succesfully --- src/ui.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui.cpp b/src/ui.cpp index 6b7ecdbc8d4..bfb708b3e90 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -1222,10 +1222,9 @@ void CMainFrame::OnMenuOptionsEncryptWallet(wxCommandEvent& event) fill(strWalletPassTest.begin(), strWalletPassTest.end(), '\0'); munlock(&strWalletPass[0], strWalletPass.capacity()); munlock(&strWalletPassTest[0], strWalletPassTest.capacity()); - wxMessageBox(_("Wallet Encrypted.\nRemember that encrypting your wallet cannot fully protect your bitcoins from being stolen by malware infecting your computer."), "Bitcoin"); + wxMessageBox(_("Wallet Encrypted.\nBitcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your bitcoins from being stolen by malware infecting your computer."), "Bitcoin"); - m_menuOptions->Remove(m_menuOptionsEncryptWallet); - m_menuOptions->Insert(m_menuOptions->GetMenuItemCount() - 1, m_menuOptionsChangeWalletPassphrase); + Close(true); } void CMainFrame::OnMenuOptionsChangeWalletPassphrase(wxCommandEvent& event) From 1aafd7464f67e0ba42b18a08070a86a427e28c72 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 14:30:15 -0500 Subject: [PATCH 13/21] Fix crash-on-osx-on-shutdown bug. And cleanup CDB handling in Rewrite. --- src/db.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index b2bd7e2899c..023dc5947a2 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -34,7 +34,14 @@ static void EnvShutdown(bool fRemoveLogFiles) return; fDbEnvInit = false; - dbenv.close(0); + try + { + dbenv.close(0); + } + catch (const DbException& e) + { + printf("EnvShutdown exception: %s (%d)\n", e.what(), e.get_errno()); + } DbEnv(0).remove(GetDataDir().c_str(), 0); if (fRemoveLogFiles) @@ -229,7 +236,10 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) CDataStream ssValue; int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); if (ret == DB_NOTFOUND) + { + pcursor->close(); break; + } else if (ret != 0) { pcursor->close(); @@ -253,14 +263,11 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) } if (fSuccess) { - Db* pdb = mapDb[strFile]; - if (pdb->close(0)) - fSuccess = false; + db.Close(); + CloseDb(strFile); if (pdbCopy->close(0)) fSuccess = false; - delete pdb; delete pdbCopy; - mapDb[strFile] = NULL; } if (fSuccess) { From 831d24a19d6687edfcce54bc0be0dcad8899fc30 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 14:28:51 -0500 Subject: [PATCH 14/21] Tweak handling of boost filesystem versions (partial cherry pick) --- src/db.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db.cpp b/src/db.cpp index 023dc5947a2..b48be7ab75c 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -51,7 +51,7 @@ static void EnvShutdown(bool fRemoveLogFiles) while (it != filesystem::directory_iterator()) { const filesystem::path& p = it->path(); -#if BOOST_FILESYSTEM_VERSION == 3 +#if BOOST_FILESYSTEM_VERSION >= 3 std::string f = p.filename().generic_string(); #else std::string f = p.filename(); From 2bf36b4e7dd06d44ee3c81391338ccb708edbbaa Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 31 Oct 2011 12:42:01 -0400 Subject: [PATCH 15/21] Remove vladimir's DNS seed, at his request. --- src/net.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/net.cpp b/src/net.cpp index f5e8b71c03a..f8f6afde543 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1159,7 +1159,6 @@ void MapPort(bool /* unused fMapPort */) static const char *strDNSSeed[] = { "bitseed.xf2.org", - "bitseed.bitcoin.org.uk", "dnsseed.bluematt.me", }; From 90de05e88ecc879b75315eebacb488b44353f5d9 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 17 Nov 2011 14:01:25 -0500 Subject: [PATCH 16/21] Create new keypool for newly encrypted wallets. --- src/wallet.cpp | 33 ++++++++++++++++++++++++++++++++- src/wallet.h | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index c004d183604..9b9586face2 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -187,12 +187,15 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase) pwalletdbEncryption = NULL; } + Lock(); + Unlock(strWalletPassphrase); + NewKeyPool(); Lock(); // Need to completely rewrite the wallet file; if we don't, bdb might keep // bits of the unencrypted private key in slack space in the database file. setKeyPool.clear(); - CDB::Rewrite(strWalletFile, "\x04pool"); + CDB::Rewrite(strWalletFile); } return true; @@ -1224,6 +1227,34 @@ bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut) return true; } +// +// Mark old keypool keys as used, +// and generate all new keys +// +bool CWallet::NewKeyPool() +{ + CRITICAL_BLOCK(cs_wallet) + { + CWalletDB walletdb(strWalletFile); + BOOST_FOREACH(int64 nIndex, setKeyPool) + walletdb.ErasePool(nIndex); + setKeyPool.clear(); + + if (IsLocked()) + return false; + + int64 nKeys = max(GetArg("-keypool", 100), (int64)0); + for (int i = 0; i < nKeys; i++) + { + int64 nIndex = i+1; + walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); + setKeyPool.insert(nIndex); + } + printf("CWallet::NewKeyPool wrote %"PRI64d" new keys\n", nKeys); + } + return true; +} + bool CWallet::TopUpKeyPool() { CRITICAL_BLOCK(cs_wallet) diff --git a/src/wallet.h b/src/wallet.h index 1dd2e512602..794139233d0 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -81,6 +81,7 @@ public: std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); std::string SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); + bool NewKeyPool(); bool TopUpKeyPool(); void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool); void KeepKey(int64 nIndex); From c4a3bf9e552f25a5ad0efb8cf62d344a7dad53ed Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 17 Nov 2011 14:21:32 -0500 Subject: [PATCH 17/21] Only remove database log files on shutdown after wallet encryption/rewrite --- src/db.cpp | 13 +++++++++---- src/db.h | 3 ++- src/init.cpp | 4 ++-- src/wallet.cpp | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index b48be7ab75c..77000ab00eb 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -28,7 +28,12 @@ DbEnv dbenv(0); static map mapFileUseCount; static map mapDb; -static void EnvShutdown(bool fRemoveLogFiles) +static bool fRemoveLogFiles = false; +void RemoveLogFilesOnShutdown(bool fIn) +{ + fRemoveLogFiles = fIn; +} +static void EnvShutdown() { if (!fDbEnvInit) return; @@ -71,7 +76,7 @@ public: } ~CDBInit() { - EnvShutdown(false); + EnvShutdown(); } } instance_of_cdbinit; @@ -289,7 +294,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) } -void DBFlush(bool fShutdown, bool fRemoveLogFiles) +void DBFlush(bool fShutdown) { // Flush log data to the actual data file // on all files that are not in use @@ -322,7 +327,7 @@ void DBFlush(bool fShutdown, bool fRemoveLogFiles) if (mapFileUseCount.empty()) { dbenv.log_archive(&listp, DB_ARCH_REMOVE); - EnvShutdown(fRemoveLogFiles); + EnvShutdown(); } } } diff --git a/src/db.h b/src/db.h index 98af4be9a0e..425dc2e57b8 100644 --- a/src/db.h +++ b/src/db.h @@ -29,7 +29,8 @@ extern unsigned int nWalletDBUpdated; extern DbEnv dbenv; -extern void DBFlush(bool fShutdown, bool fRemoveLogFiles); +extern void RemoveLogFilesOnShutdown(bool fRemoveLogFiles); +extern void DBFlush(bool fShutdown); void ThreadFlushWalletDB(void* parg); bool BackupWallet(const CWallet& wallet, const std::string& strDest); diff --git a/src/init.cpp b/src/init.cpp index 4a149b31bf3..2d21a261437 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -45,9 +45,9 @@ void Shutdown(void* parg) { fShutdown = true; nTransactionsUpdated++; - DBFlush(false, false); + DBFlush(false); StopNode(); - DBFlush(true, true); + DBFlush(true); boost::filesystem::remove(GetPidFile()); UnregisterWallet(pwalletMain); delete pwalletMain; diff --git a/src/wallet.cpp b/src/wallet.cpp index 9b9586face2..737f0e6238c 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -194,8 +194,8 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase) // Need to completely rewrite the wallet file; if we don't, bdb might keep // bits of the unencrypted private key in slack space in the database file. - setKeyPool.clear(); - CDB::Rewrite(strWalletFile); + if (CDB::Rewrite(strWalletFile)) + RemoveLogFilesOnShutdown(true); } return true; @@ -1134,6 +1134,7 @@ int CWallet::LoadWallet(bool& fFirstRunRet) { if (CDB::Rewrite(strWalletFile, "\x04pool")) { + RemoveLogFilesOnShutdown(true); setKeyPool.clear(); // Note: can't top-up keypool here, because wallet is locked. // User will be prompted to unlock wallet the next operation From 76ef6d89b98b57d2ee5c6db993cd1cc375dd3726 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 20 Nov 2011 10:39:01 -0500 Subject: [PATCH 18/21] Never remove database files on shutdown, it caused unreadable wallets on some testers' machines. --- src/db.cpp | 23 ----------------------- src/db.h | 2 -- src/wallet.cpp | 4 +--- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 77000ab00eb..5cacf196920 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -28,11 +28,6 @@ DbEnv dbenv(0); static map mapFileUseCount; static map mapDb; -static bool fRemoveLogFiles = false; -void RemoveLogFilesOnShutdown(bool fIn) -{ - fRemoveLogFiles = fIn; -} static void EnvShutdown() { if (!fDbEnvInit) @@ -48,24 +43,6 @@ static void EnvShutdown() printf("EnvShutdown exception: %s (%d)\n", e.what(), e.get_errno()); } DbEnv(0).remove(GetDataDir().c_str(), 0); - - if (fRemoveLogFiles) - { - filesystem::path datadir(GetDataDir()); - filesystem::directory_iterator it(datadir / "database"); - while (it != filesystem::directory_iterator()) - { - const filesystem::path& p = it->path(); -#if BOOST_FILESYSTEM_VERSION >= 3 - std::string f = p.filename().generic_string(); -#else - std::string f = p.filename(); -#endif - if (f.find("log.") == 0) - filesystem::remove(p); - ++it; - } - } } class CDBInit diff --git a/src/db.h b/src/db.h index 425dc2e57b8..15bfb29c8e9 100644 --- a/src/db.h +++ b/src/db.h @@ -28,8 +28,6 @@ class CBlockLocator; extern unsigned int nWalletDBUpdated; extern DbEnv dbenv; - -extern void RemoveLogFilesOnShutdown(bool fRemoveLogFiles); extern void DBFlush(bool fShutdown); void ThreadFlushWalletDB(void* parg); bool BackupWallet(const CWallet& wallet, const std::string& strDest); diff --git a/src/wallet.cpp b/src/wallet.cpp index 737f0e6238c..43fb6b6da39 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -194,8 +194,7 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase) // Need to completely rewrite the wallet file; if we don't, bdb might keep // bits of the unencrypted private key in slack space in the database file. - if (CDB::Rewrite(strWalletFile)) - RemoveLogFilesOnShutdown(true); + CDB::Rewrite(strWalletFile); } return true; @@ -1134,7 +1133,6 @@ int CWallet::LoadWallet(bool& fFirstRunRet) { if (CDB::Rewrite(strWalletFile, "\x04pool")) { - RemoveLogFilesOnShutdown(true); setKeyPool.clear(); // Note: can't top-up keypool here, because wallet is locked. // User will be prompted to unlock wallet the next operation From 36b1eb763101299a4c4d4dad9d40b8ff70011d11 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 20 Nov 2011 17:12:00 +0100 Subject: [PATCH 19/21] close old db when rewriting --- src/db.cpp | 108 +++++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 5cacf196920..f9a7d6c90a5 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -195,61 +195,63 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) bool fSuccess = true; printf("Rewriting %s...\n", strFile.c_str()); string strFileRes = strFile + ".rewrite"; - CDB db(strFile.c_str(), "r"); - Db* pdbCopy = new Db(&dbenv, 0); - - int ret = pdbCopy->open(NULL, // Txn pointer - strFileRes.c_str(), // Filename - "main", // Logical db name - DB_BTREE, // Database type - DB_CREATE, // Flags - 0); - if (ret > 0) - { - printf("Cannot create database file %s\n", strFileRes.c_str()); - fSuccess = false; - } - - Dbc* pcursor = db.GetCursor(); - if (pcursor) - while (fSuccess) + { // surround usage of db with extra {} + CDB db(strFile.c_str(), "r"); + Db* pdbCopy = new Db(&dbenv, 0); + + int ret = pdbCopy->open(NULL, // Txn pointer + strFileRes.c_str(), // Filename + "main", // Logical db name + DB_BTREE, // Database type + DB_CREATE, // Flags + 0); + if (ret > 0) { - CDataStream ssKey; - CDataStream ssValue; - int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); - if (ret == DB_NOTFOUND) - { - pcursor->close(); - break; - } - else if (ret != 0) - { - pcursor->close(); - fSuccess = false; - break; - } - if (pszSkip && - strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) - continue; - if (strncmp(&ssKey[0], "\x07version", 8) == 0) - { - // Update version: - ssValue.clear(); - ssValue << VERSION; - } - Dbt datKey(&ssKey[0], ssKey.size()); - Dbt datValue(&ssValue[0], ssValue.size()); - int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); - if (ret2 > 0) - fSuccess = false; - } - if (fSuccess) - { - db.Close(); - CloseDb(strFile); - if (pdbCopy->close(0)) + printf("Cannot create database file %s\n", strFileRes.c_str()); fSuccess = false; - delete pdbCopy; + } + + Dbc* pcursor = db.GetCursor(); + if (pcursor) + while (fSuccess) + { + CDataStream ssKey; + CDataStream ssValue; + int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); + if (ret == DB_NOTFOUND) + { + pcursor->close(); + break; + } + else if (ret != 0) + { + pcursor->close(); + fSuccess = false; + break; + } + if (pszSkip && + strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) + continue; + if (strncmp(&ssKey[0], "\x07version", 8) == 0) + { + // Update version: + ssValue.clear(); + ssValue << VERSION; + } + Dbt datKey(&ssKey[0], ssKey.size()); + Dbt datValue(&ssValue[0], ssValue.size()); + int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); + if (ret2 > 0) + fSuccess = false; + } + if (fSuccess) + { + db.Close(); + CloseDb(strFile); + if (pdbCopy->close(0)) + fSuccess = false; + delete pdbCopy; + } } if (fSuccess) { From d885aba347c2c53f71fdd5aef588b7115d689183 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 21 Nov 2011 13:38:09 -0500 Subject: [PATCH 20/21] Bump version to 0.4.2 --- contrib/Bitcoin.app/Contents/Info.plist | 2 +- doc/README | 2 +- doc/README_windows.txt | 2 +- share/setup.nsi | 6 +++--- src/serialize.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/Bitcoin.app/Contents/Info.plist b/contrib/Bitcoin.app/Contents/Info.plist index d5a278a570c..9145db10f15 100644 --- a/contrib/Bitcoin.app/Contents/Info.plist +++ b/contrib/Bitcoin.app/Contents/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4.1 + 0.4.2 CFBundleSignature ???? CFBundleVersion diff --git a/doc/README b/doc/README index 789cc9fb870..9c28f4c6929 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.4.1 BETA +Bitcoin 0.4.2 BETA Copyright (c) 2009-2011 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 7ff8834920b..7a406d65a37 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.4.1 BETA +Bitcoin 0.4.2 BETA Copyright (c) 2009-2011 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/share/setup.nsi b/share/setup.nsi index 4c837c974bf..4500dc48e1b 100644 --- a/share/setup.nsi +++ b/share/setup.nsi @@ -5,7 +5,7 @@ SetCompressor /SOLID lzma # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define VERSION 0.4.1 +!define VERSION 0.4.2 !define COMPANY "Bitcoin project" !define URL http://www.bitcoin.org/ @@ -45,13 +45,13 @@ Var StartMenuGroup !insertmacro MUI_LANGUAGE English # Installer attributes -OutFile bitcoin-0.4.1-win32-setup.exe +OutFile bitcoin-0.4.2-win32-setup.exe InstallDir $PROGRAMFILES\Bitcoin CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion 0.4.1.0 +VIProductVersion 0.4.2.0 VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/src/serialize.h b/src/serialize.h index c531d2a198e..64fae0367ea 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -59,7 +59,7 @@ class CDataStream; class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -static const int VERSION = 40101; +static const int VERSION = 40200; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; From 45593c271a5a039d75fc136e46fac71fcb52e779 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 21 Nov 2011 14:38:47 -0500 Subject: [PATCH 21/21] Don't forget to bump release numbers in READMEs next time --- doc/release-process.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release-process.txt b/doc/release-process.txt index bcda64dbed5..953761b4a95 100644 --- a/doc/release-process.txt +++ b/doc/release-process.txt @@ -1,6 +1,7 @@ * update (commit) version in sources src/serialize.h share/setup.nsi + doc/README* * update (commit) version in OSX app bundle contrib/Bitcoin.app/Contents/Info.plist