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: 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 76a2700271..d6a113095d 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; -- cgit v1.2.3 From 600dc6255971bfe152767c67e7ca6866fb1541ea Mon Sep 17 00:00:00 2001 From: Victor Leschuk Date: Thu, 6 Oct 2011 19:53:42 +0400 Subject: 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 3d7ef108b4..6ecc92b2b6 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); -- cgit v1.2.3 From aec5c5fe26293452d3fe7acf1e4c20830613812c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 10 Oct 2011 14:22:31 -0400 Subject: 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 a5c7da1c8f..d5a278a570 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 772fd7f31e..789cc9fb87 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 8378ae50d8..7ff8834920 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 6cf477747c..4c837c974b 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 698bdfe6a9..320ce9d2ae 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; -- cgit v1.2.3 From b526cbaa718a6c66bc6b5bc224d2717e0066ddb6 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 10 Oct 2011 16:03:14 -0400 Subject: 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 43c3ea7f50..98c40771d2 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 -- cgit v1.2.3 From 38a976d5bbfb1bdb304ae64aa3ca992d13ad3cde Mon Sep 17 00:00:00 2001 From: cjdelisle Date: Sun, 16 Oct 2011 20:38:23 -0400 Subject: 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 98c40771d2..9e0b3263d7 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 -- cgit v1.2.3 From ed176ba584ed9f05f5311743059e108ddbbb5d5b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 10 Oct 2011 12:08:05 -0400 Subject: 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 d0c7434820..ab318cbb43 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 -- cgit v1.2.3 From ef4280e08b217bf2512bb1878e1dd2a926e557c9 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 10 Oct 2011 15:51:07 -0400 Subject: 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 bbfac83d1f..1f2c6aea3e 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 8bbb80cf25..298a2c6428 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) -- cgit v1.2.3 From 00eae584a26295dbf7b1aebf99c1b8a4c9a86c37 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 10 Nov 2011 21:29:23 +0100 Subject: 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 a22b17e34c..d41da68aba 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 73ea1902cc..75748ace01 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 298a2c6428..924700d027 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(); -- cgit v1.2.3 From 2744ea8c1fbc2e1ef6b1824a21fd2a75e2b6dbc4 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 10 Nov 2011 21:12:46 -0500 Subject: 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 d41da68aba..1a1289f8d1 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 75748ace01..98af4be9a0 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 dbc2c41332..4a149b31bf 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 885ffd1f2b..a936edbbe4 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 320ce9d2ae..c531d2a198 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 924700d027..c004d18360 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) -- cgit v1.2.3 From 0143c024af1e5b93dfc3a89e4e40be59a0f40f58 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 09:47:29 -0500 Subject: 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 1a1289f8d1..b2bd7e2899 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); -- cgit v1.2.3 From 1179f6373dfffdcb091576215cabe73c932df925 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 15 Nov 2011 10:33:26 -0500 Subject: 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 52b10bc33f..252e62e236 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 efa9cb8c10..c29224402a 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" -- cgit v1.2.3 From 586ea168c2e29b9f96b07a3a5145356af11b4dce Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 15 Nov 2011 10:21:02 -0500 Subject: 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 6b7ecdbc8d..bfb708b3e9 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) -- cgit v1.2.3 From 1aafd7464f67e0ba42b18a08070a86a427e28c72 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 14:30:15 -0500 Subject: 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 b2bd7e2899..023dc5947a 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) { -- cgit v1.2.3 From 831d24a19d6687edfcce54bc0be0dcad8899fc30 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 15 Nov 2011 14:28:51 -0500 Subject: 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 023dc5947a..b48be7ab75 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(); -- cgit v1.2.3 From 2bf36b4e7dd06d44ee3c81391338ccb708edbbaa Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 31 Oct 2011 12:42:01 -0400 Subject: 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 f5e8b71c03..f8f6afde54 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", }; -- cgit v1.2.3 From 90de05e88ecc879b75315eebacb488b44353f5d9 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 17 Nov 2011 14:01:25 -0500 Subject: 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 c004d18360..9b9586face 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 1dd2e51260..794139233d 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); -- cgit v1.2.3 From c4a3bf9e552f25a5ad0efb8cf62d344a7dad53ed Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 17 Nov 2011 14:21:32 -0500 Subject: 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 b48be7ab75..77000ab00e 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 98af4be9a0..425dc2e57b 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 4a149b31bf..2d21a26143 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 9b9586face..737f0e6238 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 -- cgit v1.2.3 From 76ef6d89b98b57d2ee5c6db993cd1cc375dd3726 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 20 Nov 2011 10:39:01 -0500 Subject: 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 77000ab00e..5cacf19692 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 425dc2e57b..15bfb29c8e 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 737f0e6238..43fb6b6da3 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 -- cgit v1.2.3 From 36b1eb763101299a4c4d4dad9d40b8ff70011d11 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 20 Nov 2011 17:12:00 +0100 Subject: close old db when rewriting --- src/db.cpp | 102 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 5cacf19692..f9a7d6c90a 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) + printf("Cannot create database file %s\n", strFileRes.c_str()); + fSuccess = false; + } + + Dbc* pcursor = db.GetCursor(); + if (pcursor) + while (fSuccess) { - // Update version: - ssValue.clear(); - ssValue << VERSION; + 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; } - Dbt datKey(&ssKey[0], ssKey.size()); - Dbt datValue(&ssValue[0], ssValue.size()); - int ret2 = pdbCopy->put(NULL, &datKey, &datValue, DB_NOOVERWRITE); - if (ret2 > 0) + if (fSuccess) + { + db.Close(); + CloseDb(strFile); + if (pdbCopy->close(0)) fSuccess = false; + delete pdbCopy; } - if (fSuccess) - { - db.Close(); - CloseDb(strFile); - if (pdbCopy->close(0)) - fSuccess = false; - delete pdbCopy; } if (fSuccess) { -- cgit v1.2.3 From d885aba347c2c53f71fdd5aef588b7115d689183 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 21 Nov 2011 13:38:09 -0500 Subject: 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 d5a278a570..9145db10f1 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 789cc9fb87..9c28f4c692 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 7ff8834920..7a406d65a3 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 4c837c974b..4500dc48e1 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 c531d2a198..64fae0367e 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; -- cgit v1.2.3 From 45593c271a5a039d75fc136e46fac71fcb52e779 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 21 Nov 2011 14:38:47 -0500 Subject: 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 bcda64dbed..953761b4a9 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 -- cgit v1.2.3 From 99fe0af2feaea626541fc14f479e6890202fb617 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 21 Nov 2011 14:37:59 -0500 Subject: Bump version numbers to 0.5.1 --- doc/README | 2 +- doc/README_windows.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README b/doc/README index f45bf0c152..5e0f8ee1ed 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.5.0 BETA +Bitcoin 0.5.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 ea2f14c42a..d237615f57 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.5.0 BETA +Bitcoin 0.5.1 BETA Copyright (c) 2009-2011 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying -- cgit v1.2.3 From adb9f7ddde0d31c7b70d37cd30ee8e5bd8a3b2f8 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 21 Nov 2011 14:38:47 -0500 Subject: 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 ac388847c2..14d8efeb32 100644 --- a/doc/release-process.txt +++ b/doc/release-process.txt @@ -2,6 +2,7 @@ bitcoin-qt.pro src/serialize.h share/setup.nsi + doc/README* * tag version in git -- cgit v1.2.3 From 7597fcd92feb63f4ff2abf074ae70b3f575737e4 Mon Sep 17 00:00:00 2001 From: Alex B Date: Thu, 24 Nov 2011 12:32:19 +0100 Subject: Small fixes in both spanish translations --- src/qt/locale/bitcoin_es.ts | 63 ++++++++++++++++++++++++++++-------------- src/qt/locale/bitcoin_es_CL.ts | 63 ++++++++++++++++++++++++++++-------------- 2 files changed, 86 insertions(+), 40 deletions(-) diff --git a/src/qt/locale/bitcoin_es.ts b/src/qt/locale/bitcoin_es.ts index e2ec6bff54..49e0f0a2c7 100644 --- a/src/qt/locale/bitcoin_es.ts +++ b/src/qt/locale/bitcoin_es.ts @@ -1,4 +1,6 @@ - + + + UTF-8 AboutDialog @@ -321,7 +323,7 @@ Are you sure you wish to encrypt your wallet? E&xit - + &Salir @@ -331,7 +333,7 @@ Are you sure you wish to encrypt your wallet? &About %1 - + S&obre %1 @@ -426,7 +428,10 @@ Are you sure you wish to encrypt your wallet? %n active connection(s) to Bitcoin network - %n conexión activa hacia la red Bitcoin%n conexiones activas hacia la red Bitcoin + + %n conexión activa hacia la red Bitcoin + %n conexiones activas hacia la red Bitcoin + @@ -441,22 +446,34 @@ Are you sure you wish to encrypt your wallet? %n second(s) ago - Hace %n segundoHace %n segundos + + Hace %n segundo + Hace %n segundos + %n minute(s) ago - Hace %n minutoHace %n minutos + + Hace %n minuto + Hace %n minutos + %n hour(s) ago - Hace %n horaHace %n horas + + Hace %n hora + Hace %n horas + %n day(s) ago - Hace %n díaHace %n días + + Hace %n día + Hace %n días + @@ -750,12 +767,12 @@ Dirección: %4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wallet</span></p></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Cartera</span></p></body></html> @@ -988,12 +1005,12 @@ p, li { white-space: pre-wrap; } , broadcast through %1 node - , emitido mediante %d nodo + , emitido mediante %1 nodo , broadcast through %1 nodes - , emitido mediante %d nodos + , emitido mediante %1 nodos @@ -1044,7 +1061,7 @@ p, li { white-space: pre-wrap; } (%1 matures in %2 more blocks) - (%s madura en %d bloques mas) + (%1 madura en %1 bloques mas) @@ -1122,7 +1139,10 @@ p, li { white-space: pre-wrap; } Open for %n block(s) - Abierto por %n bloqueAbierto por %n bloques + + Abierto por %n bloque + Abierto por %n bloques + @@ -1147,7 +1167,10 @@ p, li { white-space: pre-wrap; } Mined balance will be available in %n more blocks - El balance minado estará disponible en %n bloque masEl balance minado estará disponible en %n bloques mas + + El balance minado estará disponible en %n bloque mas + El balance minado estará disponible en %n bloques mas + @@ -1450,7 +1473,7 @@ p, li { white-space: pre-wrap; } - Don't generate coins + Don't generate coins No generar monedas @@ -1506,14 +1529,14 @@ p, li { white-space: pre-wrap; } - Don't accept connections from outside + Don't accept connections from outside No aceptar conexiones desde el exterior - Don't attempt to use UPnP to map the listening port + Don't attempt to use UPnP to map the listening port No intentar usar UPnP para mapear el puerto de entrada @@ -2336,7 +2359,7 @@ pero la información de los comentarios quedará en blanco. Bitcoin Qt - + Bitcoin Qt - \ No newline at end of file + diff --git a/src/qt/locale/bitcoin_es_CL.ts b/src/qt/locale/bitcoin_es_CL.ts index b44c143446..bb9d299790 100644 --- a/src/qt/locale/bitcoin_es_CL.ts +++ b/src/qt/locale/bitcoin_es_CL.ts @@ -1,4 +1,6 @@ - + + + UTF-8 AboutDialog @@ -321,7 +323,7 @@ Are you sure you wish to encrypt your wallet? E&xit - + &Salir @@ -331,7 +333,7 @@ Are you sure you wish to encrypt your wallet? &About %1 - + S&obre %1 @@ -426,7 +428,10 @@ Are you sure you wish to encrypt your wallet? %n active connection(s) to Bitcoin network - %n conexión activa hacia la red Bitcoin%n conexiones activas hacia la red Bitcoin + + %n conexión activa hacia la red Bitcoin + %n conexiones activas hacia la red Bitcoin + @@ -441,22 +446,34 @@ Are you sure you wish to encrypt your wallet? %n second(s) ago - Hace %n segundoHace %n segundos + + Hace %n segundo + Hace %n segundos + %n minute(s) ago - Hace %n minutoHace %n minutos + + Hace %n minuto + Hace %n minutos + %n hour(s) ago - Hace %n horaHace %n horas + + Hace %n hora + Hace %n horas + %n day(s) ago - Hace %n díaHace %n días + + Hace %n día + Hace %n días + @@ -750,12 +767,12 @@ Dirección: %4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wallet</span></p></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Cartera</span></p></body></html> @@ -988,12 +1005,12 @@ p, li { white-space: pre-wrap; } , broadcast through %1 node - , emitido mediante %d nodo + , emitido mediante %1 nodo , broadcast through %1 nodes - , emitido mediante %d nodos + , emitido mediante %1 nodos @@ -1044,7 +1061,7 @@ p, li { white-space: pre-wrap; } (%1 matures in %2 more blocks) - (%s madura en %d bloques mas) + (%1 madura en %2 bloques mas) @@ -1122,7 +1139,10 @@ p, li { white-space: pre-wrap; } Open for %n block(s) - Abierto por %n bloqueAbierto por %n bloques + + Abierto por %n bloque + Abierto por %n bloques + @@ -1147,7 +1167,10 @@ p, li { white-space: pre-wrap; } Mined balance will be available in %n more blocks - El balance minado estará disponible en %n bloque masEl balance minado estará disponible en %n bloques mas + + El balance minado estará disponible en %n bloque mas + El balance minado estará disponible en %n bloques mas + @@ -1450,7 +1473,7 @@ p, li { white-space: pre-wrap; } - Don't generate coins + Don't generate coins No generar monedas @@ -1506,14 +1529,14 @@ p, li { white-space: pre-wrap; } - Don't accept connections from outside + Don't accept connections from outside No aceptar conexiones desde el exterior - Don't attempt to use UPnP to map the listening port + Don't attempt to use UPnP to map the listening port No intentar usar UPnP para mapear el puerto de entrada @@ -2336,7 +2359,7 @@ pero la información de los comentarios quedará en blanco. Bitcoin Qt - + Bitcoin Qt - \ No newline at end of file + -- cgit v1.2.3 From 1c4be55a993bf77a5d44b9f468c12506e5b051ba Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 24 Nov 2011 13:40:32 +0100 Subject: update translation: de --- src/qt/locale/bitcoin_de.ts | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/qt/locale/bitcoin_de.ts b/src/qt/locale/bitcoin_de.ts index 97eb5cb642..f7b134a75d 100644 --- a/src/qt/locale/bitcoin_de.ts +++ b/src/qt/locale/bitcoin_de.ts @@ -328,7 +328,7 @@ Sind Sie sich sicher, dass Sie Ihre Brieftasche verschlüsseln möchten? &About %1 - + &Über %1 @@ -1885,7 +1885,7 @@ Are you sure you wish to encrypt your wallet? Wallet encryption failed. - + Verschlüsselung der Brieftasche fehlgeschlagen. @@ -1896,22 +1896,22 @@ Remember that encrypting your wallet cannot fully protect your bitcoins from bei Wallet is unencrypted, please encrypt it first. - + Brieftasche nicht verschlüsselt, bitte zuerst verschlüsseln. Enter the new passphrase for the wallet. - + Gib eine neue Passphrase für die Brieftasche eine. Re-enter the new passphrase for the wallet. - + Gib die neue Passphrase erneut ein. Wallet Passphrase Changed. - + Passphrase geändert. @@ -1948,7 +1948,7 @@ Label <b>Date:</b> - + <b>Datum:</b> @@ -1958,7 +1958,7 @@ Label <b>From:</b> - + <b>Von:</b> @@ -2003,7 +2003,7 @@ Label <b>Transaction fee:</b> - + <b>Transaktionsgebühr:</b> @@ -2048,7 +2048,7 @@ Label version %s - + Version %s @@ -2063,7 +2063,7 @@ Label Amount exceeds your balance - + Betrag übersteigt Ihr Guthaben @@ -2078,7 +2078,7 @@ Label Payment sent - + Zahlung gesendet @@ -2088,22 +2088,22 @@ Label Invalid address - + ungültige Adresse Sending %s to %s - + Sende %s an %s CANCELLED - + ABGEBROCHEN Cancelled - + Abgebrochen @@ -2113,7 +2113,7 @@ Label Error: - + Fehler: @@ -2123,12 +2123,12 @@ Label Connecting... - + Verbinde... Unable to connect - + Kann nicht verbinden @@ -2173,7 +2173,7 @@ Label Transaction aborted - + Transaktion abgebrochen @@ -2183,17 +2183,17 @@ Label Sending payment... - + Sende Zahlung... The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here. - + Fehler: Die Transaktion wurde abgelehnt. Dies kann passieren, wenn einige Ihrer Bitcoins aus Ihrer Brieftasche bereits ausgegeben wurden (z.B. aus einer Sicherungskopie Ihrer wallet.dat). Waiting for confirmation... - + Warte auf Bestätigung... @@ -2210,12 +2210,12 @@ but the comment information will be blank. Payment completed - + Die Zahlung wurde abgeschlossen Name - + Name @@ -2230,7 +2230,7 @@ but the comment information will be blank. Bitcoin Address - + Bitcoin Adresse @@ -2250,22 +2250,22 @@ but the comment information will be blank. Add Address - + Adresse hinzufügen Bitcoin - + Bitcoin Bitcoin - Generating - + Bitcoin - Generiere Bitcoin - (not connected) - + Bitcoin - (nicht verbunden) @@ -2300,7 +2300,7 @@ but the comment information will be blank. beta - + Beta @@ -2308,7 +2308,7 @@ but the comment information will be blank. Bitcoin Qt - + Bitcoin Qt \ No newline at end of file -- cgit v1.2.3 From 094c35cffc74cd6843cd858ca9afba7056db1ff3 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 24 Nov 2011 20:20:01 +0100 Subject: allow for filtering addresses and labels by searching for the typed string anywhere, not just at the beginning (#641) --- src/qt/transactionfilterproxy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index a4c5b37171..16fb4dab92 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -35,7 +35,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex & return false; if(datetime < dateFrom || datetime > dateTo) return false; - if(!address.startsWith(addrPrefix) && !label.startsWith(addrPrefix)) + if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive)) return false; if(amount < minAmount) return false; -- cgit v1.2.3 From a7d735dcc25c85ad883e6d619848ce0478ebe299 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 27 Nov 2011 14:53:30 -0500 Subject: Add missing command-line arguments to --help/-? output --- src/init.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 2d21a26143..68303c19fa 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -162,10 +162,10 @@ bool AppInit2(int argc, char* argv[]) string strUsage = string() + _("Bitcoin version") + " " + FormatFullVersion() + "\n\n" + _("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" + - " bitcoin [options] \t " + "\n" + - " bitcoin [options] [params]\t " + _("Send command to -server or bitcoind\n") + - " bitcoin [options] help \t\t " + _("List commands\n") + - " bitcoin [options] help \t\t " + _("Get help for a command\n") + + " bitcoind [options] \t " + "\n" + + " bitcoind [options] [params]\t " + _("Send command to -server or bitcoind\n") + + " bitcoind [options] help \t\t " + _("List commands\n") + + " bitcoind [options] help \t\t " + _("Get help for a command\n") + _("Options:\n") + " -conf= \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") + " -pid= \t\t " + _("Specify pid file (default: bitcoind.pid)\n") + @@ -176,9 +176,14 @@ bool AppInit2(int argc, char* argv[]) " -timeout= \t " + _("Specify connection timeout (in milliseconds)\n") + " -proxy= \t " + _("Connect through socks4 proxy\n") + " -dns \t " + _("Allow DNS lookups for addnode and connect\n") + + " -port= \t\t " + _("Listen for connections on (default: 8333 or testnet: 18333)\n") + + " -maxconnections=\t " + _("Maintain at most connections to peers (default: 125)\n") + " -addnode= \t " + _("Add a node to connect to\n") + " -connect= \t\t " + _("Connect only to the specified node\n") + " -nolisten \t " + _("Don't accept connections from outside\n") + + " -nodnsseed \t " + _("Don't bootstrap list of peers using DNS\n") + + " -maxreceivebuffer=\t " + _("Maximum per-connection receive buffer, *1000 bytes (default: 10000)\n") + + " -maxsendbuffer=\t " + _("Maximum per-connection send buffer, *1000 bytes (default: 10000)\n") + #ifdef USE_UPNP #if USE_UPNP " -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") + @@ -194,6 +199,12 @@ bool AppInit2(int argc, char* argv[]) " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + #endif " -testnet \t\t " + _("Use the test network\n") + + " -debug \t\t " + _("Output extra debugging information\n") + + " -logtimestamps \t " + _("Prepend debug output with timestamp\n") + + " -printtoconsole \t " + _("Send trace/debug info to console instead of debug.log file\n") + +#ifdef WIN32 + " -printtodebugger \t " + _("Send trace/debug info to debugger\n") + +#endif " -rpcuser= \t " + _("Username for JSON-RPC connections\n") + " -rpcpassword=\t " + _("Password for JSON-RPC connections\n") + " -rpcport= \t\t " + _("Listen for JSON-RPC connections on (default: 8332)\n") + -- cgit v1.2.3 From cba18514c0d5b364ee96a984c255dc9e29a00d68 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 27 Nov 2011 14:53:30 -0500 Subject: Add missing command-line arguments to --help/-? output --- src/init.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index a6d0ab56e3..367e75f39b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -172,10 +172,10 @@ bool AppInit2(int argc, char* argv[]) string strUsage = string() + _("Bitcoin version") + " " + FormatFullVersion() + "\n\n" + _("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" + - " bitcoin [options] \t " + "\n" + - " bitcoin [options] [params]\t " + _("Send command to -server or bitcoind\n") + - " bitcoin [options] help \t\t " + _("List commands\n") + - " bitcoin [options] help \t\t " + _("Get help for a command\n") + + " bitcoind [options] \t " + "\n" + + " bitcoind [options] [params]\t " + _("Send command to -server or bitcoind\n") + + " bitcoind [options] help \t\t " + _("List commands\n") + + " bitcoind [options] help \t\t " + _("Get help for a command\n") + _("Options:\n") + " -conf= \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") + " -pid= \t\t " + _("Specify pid file (default: bitcoind.pid)\n") + @@ -186,11 +186,16 @@ bool AppInit2(int argc, char* argv[]) " -timeout= \t " + _("Specify connection timeout (in milliseconds)\n") + " -proxy= \t " + _("Connect through socks4 proxy\n") + " -dns \t " + _("Allow DNS lookups for addnode and connect\n") + + " -port= \t\t " + _("Listen for connections on (default: 8333 or testnet: 18333)\n") + + " -maxconnections=\t " + _("Maintain at most connections to peers (default: 125)\n") + " -addnode= \t " + _("Add a node to connect to\n") + " -connect= \t\t " + _("Connect only to the specified node\n") + " -nolisten \t " + _("Don't accept connections from outside\n") + + " -nodnsseed \t " + _("Don't bootstrap list of peers using DNS\n") + " -banscore= \t " + _("Threshold for disconnecting misbehaving peers (default: 100)\n") + " -bantime= \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)\n") + + " -maxreceivebuffer=\t " + _("Maximum per-connection receive buffer, *1000 bytes (default: 10000)\n") + + " -maxsendbuffer=\t " + _("Maximum per-connection send buffer, *1000 bytes (default: 10000)\n") + #ifdef USE_UPNP #if USE_UPNP " -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") + @@ -206,6 +211,12 @@ bool AppInit2(int argc, char* argv[]) " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + #endif " -testnet \t\t " + _("Use the test network\n") + + " -debug \t\t " + _("Output extra debugging information\n") + + " -logtimestamps \t " + _("Prepend debug output with timestamp\n") + + " -printtoconsole \t " + _("Send trace/debug info to console instead of debug.log file\n") + +#ifdef WIN32 + " -printtodebugger \t " + _("Send trace/debug info to debugger\n") + +#endif " -rpcuser= \t " + _("Username for JSON-RPC connections\n") + " -rpcpassword=\t " + _("Password for JSON-RPC connections\n") + " -rpcport= \t\t " + _("Listen for JSON-RPC connections on (default: 8332)\n") + -- cgit v1.2.3 From 3741185a51cada1adb17b1578a086544101ce7c7 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 26 Nov 2011 09:55:12 +0100 Subject: Make home and addressbook icon more consistent with other toolbar icons (make it blue and flip light source direction) --- src/qt/res/icons/address-book.png | Bin 1851 -> 1916 bytes src/qt/res/icons/overview.png | Bin 7936 -> 7455 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/res/icons/address-book.png b/src/qt/res/icons/address-book.png index dbfc28ab3d..d41dbe6539 100644 Binary files a/src/qt/res/icons/address-book.png and b/src/qt/res/icons/address-book.png differ diff --git a/src/qt/res/icons/overview.png b/src/qt/res/icons/overview.png index 3b90fe5569..ee2511f01d 100644 Binary files a/src/qt/res/icons/overview.png and b/src/qt/res/icons/overview.png differ -- cgit v1.2.3 From d27be1f55777bd502beb6b89513f1a03ed988f1a Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 8 Sep 2011 16:50:58 -0400 Subject: Moved checkpoints out of main, to prep for using them to help prevent DoS attacks --- bitcoin-qt.pro | 2 ++ src/checkpoints.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++ src/checkpoints.h | 22 +++++++++++++++++++++ src/main.cpp | 32 +++++-------------------------- src/main.h | 1 - src/makefile.linux-mingw | 2 ++ src/makefile.mingw | 2 ++ src/makefile.osx | 2 ++ src/makefile.unix | 2 ++ src/makefile.vc | 6 ++++++ src/test/Checkpoints_tests.cpp | 34 +++++++++++++++++++++++++++++++++ src/test/DoS_tests.cpp | 1 - src/test/test_bitcoin.cpp | 1 + 13 files changed, 121 insertions(+), 29 deletions(-) create mode 100644 src/checkpoints.cpp create mode 100644 src/checkpoints.h create mode 100644 src/test/Checkpoints_tests.cpp diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 7444ff4ac1..8fc177f7f4 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -88,6 +88,7 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/bitcoinaddressvalidator.h \ src/base58.h \ src/bignum.h \ + src/checkpoints.h \ src/util.h \ src/uint256.h \ src/serialize.h \ @@ -152,6 +153,7 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/init.cpp \ src/net.cpp \ src/irc.cpp \ + src/checkpoints.cpp \ src/db.cpp \ src/json/json_spirit_writer.cpp \ src/json/json_spirit_value.cpp \ diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp new file mode 100644 index 0000000000..4419a06c83 --- /dev/null +++ b/src/checkpoints.cpp @@ -0,0 +1,43 @@ +// Copyright (c) 2011 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. + +#include "checkpoints.h" +#include "uint256.h" +#include "util.h" + +#include // for 'map_list_of()' + +namespace Checkpoints +{ + typedef std::map MapCheckpoints; + + static MapCheckpoints mapCheckpoints = + boost::assign::map_list_of + ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) + ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) + ( 68555, uint256("0x00000000001e1b4903550a0b96e9a9405c8a95f387162e4944e8d9fbe501cd6a")) + ( 70567, uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) + ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) + (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) + (118000, uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) + (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) + (140700, uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd")) + ; + + bool CheckBlock(int nHeight, const uint256& hash) + { + if (fTestNet) return true; // Testnet has no checkpoints + + MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight); + if (i == mapCheckpoints.end()) return true; + return hash == i->second; + } + + int GetTotalBlocksEstimate() + { + if (fTestNet) return 0; // Testnet has no checkpoints + + return mapCheckpoints.rbegin()->first; + } +} diff --git a/src/checkpoints.h b/src/checkpoints.h new file mode 100644 index 0000000000..32094fdde6 --- /dev/null +++ b/src/checkpoints.h @@ -0,0 +1,22 @@ +// Copyright (c) 2011 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_CHECKPOINT_H +#define BITCOIN_CHECKPOINT_H + +class uint256; + +// +// Block-chain checkpoints are compiled-in sanity checks. +// They are updated every release or three. +// +namespace Checkpoints +{ + // Returns true if block passes checkpoint checks + bool CheckBlock(int nHeight, const uint256& hash); + + // Return conservative estimate of total number of blocks, 0 if unknown + int GetTotalBlocksEstimate(); +} + +#endif diff --git a/src/main.cpp b/src/main.cpp index 47f1090727..832a0f9240 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "headers.h" +#include "checkpoints.h" #include "db.h" #include "net.h" #include "init.h" @@ -29,7 +30,6 @@ map mapNextTx; map mapBlockIndex; uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); -const int nTotalBlocksEstimate = 140700; // Conservative estimate of total nr of blocks on main chain const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download" CBlockIndex* pindexGenesisBlock = NULL; int nBestHeight = -1; @@ -721,28 +721,15 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) return true; } -// Return conservative estimate of total number of blocks, 0 if unknown -int GetTotalBlocksEstimate() -{ - if(fTestNet) - { - return 0; - } - else - { - return nTotalBlocksEstimate; - } -} - // Return maximum amount of blocks that other nodes claim to have int GetNumBlocksOfPeers() { - return std::max(cPeerBlockCounts.median(), GetTotalBlocksEstimate()); + return std::max(cPeerBlockCounts.median(), Checkpoints::GetTotalBlocksEstimate()); } bool IsInitialBlockDownload() { - if (pindexBest == NULL || nBestHeight < (GetTotalBlocksEstimate()-nInitialBlockThreshold)) + if (pindexBest == NULL || nBestHeight < (Checkpoints::GetTotalBlocksEstimate()-nInitialBlockThreshold)) return true; static int64 nLastUpdate; static CBlockIndex* pindexLastBest; @@ -1317,17 +1304,8 @@ bool CBlock::AcceptBlock() return DoS(10, error("AcceptBlock() : contains a non-final transaction")); // Check that the block chain matches the known block chain up to a checkpoint - if (!fTestNet) - if ((nHeight == 11111 && hash != uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) || - (nHeight == 33333 && hash != uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) || - (nHeight == 68555 && hash != uint256("0x00000000001e1b4903550a0b96e9a9405c8a95f387162e4944e8d9fbe501cd6a")) || - (nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) || - (nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) || - (nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) || - (nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) || - (nHeight == 134444 && hash != uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) || - (nHeight == 140700 && hash != uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd"))) - return DoS(100, error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight)); + if (!Checkpoints::CheckBlock(nHeight, hash)) + return DoS(100, error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight)); // Write block to history file if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK))) diff --git a/src/main.h b/src/main.h index 60ca318381..f459d050ce 100644 --- a/src/main.h +++ b/src/main.h @@ -99,7 +99,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1); bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); bool CheckProofOfWork(uint256 hash, unsigned int nBits); -int GetTotalBlocksEstimate(); int GetNumBlocksOfPeers(); bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 29b433f851..61f8d4881f 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -32,6 +32,7 @@ CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATH HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -61,6 +62,7 @@ endif LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.mingw b/src/makefile.mingw index 95d09f8770..2cb78d97e6 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -29,6 +29,7 @@ CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(I HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -58,6 +59,7 @@ endif LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.osx b/src/makefile.osx index 7830f3bad5..de71887935 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -49,6 +49,7 @@ CFLAGS=-mmacosx-version-min=10.5 -arch i386 -O3 -Wno-invalid-offsetof -Wformat $ HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -69,6 +70,7 @@ HEADERS = \ wallet.h OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.unix b/src/makefile.unix index 5f841ea0fe..6c48199546 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -87,6 +87,7 @@ xCXXFLAGS=-pthread -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(HARDEN HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -107,6 +108,7 @@ HEADERS = \ wallet.h OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.vc b/src/makefile.vc index c7e8578a95..60f1e09633 100644 --- a/src/makefile.vc +++ b/src/makefile.vc @@ -43,6 +43,7 @@ CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -65,6 +66,7 @@ HEADERS = \ wallet.h OBJS= \ + obj\checkpoints.o \ obj\crypter.o \ obj\db.o \ obj\init.o \ @@ -87,6 +89,8 @@ all: bitcoind.exe .cpp{obj}.obj: cl $(CFLAGS) /DGUI /Fo$@ %s +obj\checkpoints.obj: $(HEADERS) + obj\util.obj: $(HEADERS) obj\script.obj: $(HEADERS) @@ -116,6 +120,8 @@ obj\uibase.obj: $(HEADERS) .cpp{obj\nogui}.obj: cl $(CFLAGS) /Fo$@ %s +obj\nogui\checkpoints.obj: $(HEADERS) + obj\nogui\util.obj: $(HEADERS) obj\nogui\script.obj: $(HEADERS) diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp new file mode 100644 index 0000000000..0d8a366d7a --- /dev/null +++ b/src/test/Checkpoints_tests.cpp @@ -0,0 +1,34 @@ +// +// Unit tests for block-chain checkpoints +// +#include // for 'map_list_of()' +#include +#include + +#include "../checkpoints.h" +#include "../util.h" + +using namespace std; + +BOOST_AUTO_TEST_SUITE(Checkpoints_tests) + +BOOST_AUTO_TEST_CASE(sanity) +{ + uint256 p11111 = uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); + uint256 p140700 = uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd"); + BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111)); + BOOST_CHECK(Checkpoints::CheckBlock(140700, p140700)); + + + // Wrong hashes at checkpoints should fail: + BOOST_CHECK(!Checkpoints::CheckBlock(11111, p140700)); + BOOST_CHECK(!Checkpoints::CheckBlock(140700, p11111)); + + // ... but any hash not at a checkpoint should succeed: + BOOST_CHECK(Checkpoints::CheckBlock(11111+1, p140700)); + BOOST_CHECK(Checkpoints::CheckBlock(140700+1, p11111)); + + BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 140700); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index e60bb742dd..1093b73d80 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -64,5 +64,4 @@ BOOST_AUTO_TEST_CASE(DoS_bantime) BOOST_CHECK(!CNode::IsBanned(addr.ip)); } - BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 8863aad478..39a7c88e13 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -13,6 +13,7 @@ #include "util_tests.cpp" #include "base58_tests.cpp" #include "miner_tests.cpp" +#include "Checkpoints_tests.cpp" CWallet* pwalletMain; -- cgit v1.2.3 From f8c3eb9568fcaff41afb257f6058d1f33ae14358 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 8 Sep 2011 12:51:43 -0400 Subject: Orphan block fill-up-memory attack prevention --- src/checkpoints.cpp | 32 ++++++++++++++++++++++++++----- src/checkpoints.h | 7 +++++++ src/main.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++--- src/main.h | 1 + src/test/DoS_tests.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 8 deletions(-) diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 4419a06c83..c7e054df37 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -2,16 +2,23 @@ // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#include "checkpoints.h" -#include "uint256.h" -#include "util.h" - #include // for 'map_list_of()' +#include + +#include "headers.h" +#include "checkpoints.h" namespace Checkpoints { typedef std::map MapCheckpoints; + // + // What makes a good checkpoint block? + // + Is surrounded by blocks with reasonable timestamps + // (no blocks before with a timestamp after, none after with + // timestamp before) + // + Contains no strange transactions + // static MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) @@ -36,8 +43,23 @@ namespace Checkpoints int GetTotalBlocksEstimate() { - if (fTestNet) return 0; // Testnet has no checkpoints + if (fTestNet) return 0; return mapCheckpoints.rbegin()->first; } + + CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex) + { + if (fTestNet) return NULL; + + int64 nResult; + BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) + { + const uint256& hash = i.second; + std::map::const_iterator t = mapBlockIndex.find(hash); + if (t != mapBlockIndex.end()) + return t->second; + } + return NULL; + } } diff --git a/src/checkpoints.h b/src/checkpoints.h index 32094fdde6..9d52da404f 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -4,7 +4,11 @@ #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H +#include +#include "util.h" + class uint256; +class CBlockIndex; // // Block-chain checkpoints are compiled-in sanity checks. @@ -17,6 +21,9 @@ namespace Checkpoints // Return conservative estimate of total number of blocks, 0 if unknown int GetTotalBlocksEstimate(); + + // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint + CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex); } #endif diff --git a/src/main.cpp b/src/main.cpp index 832a0f9240..a7871fcc16 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -659,11 +659,32 @@ int64 static GetBlockValue(int nHeight, int64 nFees) return nSubsidy + nFees; } +static const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks +static const int64 nTargetSpacing = 10 * 60; +static const int64 nInterval = nTargetTimespan / nTargetSpacing; + +// +// minimum amount of work that could possibly be required nTime after +// minimum work required was nBase +// +unsigned int ComputeMinWork(unsigned int nBase, int64 nTime) +{ + CBigNum bnResult; + bnResult.SetCompact(nBase); + while (nTime > 0 && bnResult < bnProofOfWorkLimit) + { + // Maximum 400% adjustment... + bnResult *= 4; + // ... in best-case exactly 4-times-normal target time + nTime -= nTargetTimespan*4; + } + if (bnResult > bnProofOfWorkLimit) + bnResult = bnProofOfWorkLimit; + return bnResult.GetCompact(); +} + unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast) { - const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks - const int64 nTargetSpacing = 10 * 60; - const int64 nInterval = nTargetTimespan / nTargetSpacing; // Genesis block if (pindexLast == NULL) @@ -1340,6 +1361,28 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock) if (!pblock->CheckBlock()) return error("ProcessBlock() : CheckBlock FAILED"); + CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); + if (pcheckpoint && pblock->hashPrevBlock != hashBestChain) + { + // Extra checks to prevent "fill up memory by spamming with bogus blocks" + int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; + if (deltaTime < 0) + { + pfrom->Misbehaving(100); + return error("ProcessBlock() : block with timestamp before last checkpoint"); + } + CBigNum bnNewBlock; + bnNewBlock.SetCompact(pblock->nBits); + CBigNum bnRequired; + bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime)); + if (bnNewBlock > bnRequired) + { + pfrom->Misbehaving(100); + return error("ProcessBlock() : block with too little proof-of-work"); + } + } + + // If don't already have its previous block, shunt it off to holding area until we get it if (!mapBlockIndex.count(pblock->hashPrevBlock)) { diff --git a/src/main.h b/src/main.h index f459d050ce..3870cee864 100644 --- a/src/main.h +++ b/src/main.h @@ -99,6 +99,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1); bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); bool CheckProofOfWork(uint256 hash, unsigned int nBits); +unsigned int ComputeMinWork(unsigned int nBase, int64 nTime); int GetNumBlocksOfPeers(); bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index 1093b73d80..01e6691254 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -1,6 +1,7 @@ // // Unit tests for denial-of-service detection/prevention code // +#include // for 'map_list_of()' #include #include @@ -64,4 +65,54 @@ BOOST_AUTO_TEST_CASE(DoS_bantime) BOOST_CHECK(!CNode::IsBanned(addr.ip)); } +static bool CheckNBits(unsigned int nbits1, int64 time1, unsigned int nbits2, int64 time2) +{ + if (time1 > time2) + return CheckNBits(nbits2, time2, nbits1, time1); + int64 deltaTime = time2-time1; + + CBigNum required; + required.SetCompact(ComputeMinWork(nbits1, deltaTime)); + CBigNum have; + have.SetCompact(nbits2); + return (have <= required); +} + +BOOST_AUTO_TEST_CASE(DoS_checknbits) +{ + using namespace boost::assign; // for 'map_list_of()' + + // Timestamps,nBits from the bitcoin blockchain. + // These are the block-chain checkpoint blocks + typedef std::map BlockData; + BlockData chainData = + map_list_of(1239852051,486604799)(1262749024,486594666) + (1279305360,469854461)(1280200847,469830746)(1281678674,469809688) + (1296207707,453179945)(1302624061,453036989)(1309640330,437004818) + (1313172719,436789733); + + // Make sure CheckNBits considers every combination of block-chain-lock-in-points + // "sane": + BOOST_FOREACH(const BlockData::value_type& i, chainData) + { + BOOST_FOREACH(const BlockData::value_type& j, chainData) + { + BOOST_CHECK(CheckNBits(i.second, i.first, j.second, j.first)); + } + } + + // Test a couple of insane combinations: + BlockData::value_type firstcheck = *(chainData.begin()); + BlockData::value_type lastcheck = *(chainData.rbegin()); + + // First checkpoint difficulty at or a while after the last checkpoint time should fail when + // compared to last checkpoint + BOOST_CHECK(!CheckNBits(firstcheck.second, lastcheck.first+60*10, lastcheck.second, lastcheck.first)); + BOOST_CHECK(!CheckNBits(firstcheck.second, lastcheck.first+60*60*24*14, lastcheck.second, lastcheck.first)); + + // ... but OK if enough time passed for difficulty to adjust downward: + BOOST_CHECK(CheckNBits(firstcheck.second, lastcheck.first+60*60*24*365*4, lastcheck.second, lastcheck.first)); + +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3 From 0e6425da4a29d6944e7edce85535725e1f963e2c Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 8 Sep 2011 16:50:58 -0400 Subject: Moved checkpoints out of main, to prep for using them to help prevent DoS attacks --- src/checkpoints.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++ src/checkpoints.h | 22 +++++++++++++++++++++ src/main.cpp | 30 ++++------------------------- src/main.h | 1 - src/makefile.linux-mingw | 2 ++ src/makefile.mingw | 2 ++ src/makefile.osx | 2 ++ src/makefile.unix | 2 ++ src/makefile.vc | 6 ++++++ src/test/Checkpoints_tests.cpp | 34 +++++++++++++++++++++++++++++++++ src/test/test_bitcoin.cpp | 1 + 11 files changed, 118 insertions(+), 27 deletions(-) create mode 100644 src/checkpoints.cpp create mode 100644 src/checkpoints.h create mode 100644 src/test/Checkpoints_tests.cpp diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp new file mode 100644 index 0000000000..4419a06c83 --- /dev/null +++ b/src/checkpoints.cpp @@ -0,0 +1,43 @@ +// Copyright (c) 2011 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. + +#include "checkpoints.h" +#include "uint256.h" +#include "util.h" + +#include // for 'map_list_of()' + +namespace Checkpoints +{ + typedef std::map MapCheckpoints; + + static MapCheckpoints mapCheckpoints = + boost::assign::map_list_of + ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) + ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) + ( 68555, uint256("0x00000000001e1b4903550a0b96e9a9405c8a95f387162e4944e8d9fbe501cd6a")) + ( 70567, uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) + ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) + (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) + (118000, uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) + (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) + (140700, uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd")) + ; + + bool CheckBlock(int nHeight, const uint256& hash) + { + if (fTestNet) return true; // Testnet has no checkpoints + + MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight); + if (i == mapCheckpoints.end()) return true; + return hash == i->second; + } + + int GetTotalBlocksEstimate() + { + if (fTestNet) return 0; // Testnet has no checkpoints + + return mapCheckpoints.rbegin()->first; + } +} diff --git a/src/checkpoints.h b/src/checkpoints.h new file mode 100644 index 0000000000..32094fdde6 --- /dev/null +++ b/src/checkpoints.h @@ -0,0 +1,22 @@ +// Copyright (c) 2011 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_CHECKPOINT_H +#define BITCOIN_CHECKPOINT_H + +class uint256; + +// +// Block-chain checkpoints are compiled-in sanity checks. +// They are updated every release or three. +// +namespace Checkpoints +{ + // Returns true if block passes checkpoint checks + bool CheckBlock(int nHeight, const uint256& hash); + + // Return conservative estimate of total number of blocks, 0 if unknown + int GetTotalBlocksEstimate(); +} + +#endif diff --git a/src/main.cpp b/src/main.cpp index 6a3bacc78e..dad7d144e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "headers.h" +#include "checkpoints.h" #include "db.h" #include "net.h" #include "init.h" @@ -30,7 +31,6 @@ map mapNextTx; map mapBlockIndex; uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); -const int nTotalBlocksEstimate = 140700; // Conservative estimate of total nr of blocks on main chain const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download" CBlockIndex* pindexGenesisBlock = NULL; int nBestHeight = -1; @@ -713,22 +713,9 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) return true; } -// Return conservative estimate of total number of blocks, 0 if unknown -int GetTotalBlocksEstimate() -{ - if(fTestNet) - { - return 0; - } - else - { - return nTotalBlocksEstimate; - } -} - bool IsInitialBlockDownload() { - if (pindexBest == NULL || nBestHeight < (GetTotalBlocksEstimate()-nInitialBlockThreshold)) + if (pindexBest == NULL || nBestHeight < (Checkpoints::GetTotalBlocksEstimate()-nInitialBlockThreshold)) return true; static int64 nLastUpdate; static CBlockIndex* pindexLastBest; @@ -1294,17 +1281,8 @@ bool CBlock::AcceptBlock() return error("AcceptBlock() : contains a non-final transaction"); // Check that the block chain matches the known block chain up to a checkpoint - if (!fTestNet) - if ((nHeight == 11111 && hash != uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) || - (nHeight == 33333 && hash != uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) || - (nHeight == 68555 && hash != uint256("0x00000000001e1b4903550a0b96e9a9405c8a95f387162e4944e8d9fbe501cd6a")) || - (nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) || - (nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) || - (nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) || - (nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) || - (nHeight == 134444 && hash != uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) || - (nHeight == 140700 && hash != uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd"))) - return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); + if (!Checkpoints::CheckBlock(nHeight, hash)) + return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); // Write block to history file if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK))) diff --git a/src/main.h b/src/main.h index c400145d01..f5e7f6c3e3 100644 --- a/src/main.h +++ b/src/main.h @@ -98,7 +98,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1); bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); bool CheckProofOfWork(uint256 hash, unsigned int nBits); -int GetTotalBlocksEstimate(); bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 24cc127c2d..23b417cad1 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -38,6 +38,7 @@ CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATH HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -68,6 +69,7 @@ endif LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.mingw b/src/makefile.mingw index 1ca1a7bbe2..ef7eebf430 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -35,6 +35,7 @@ CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(I HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -66,6 +67,7 @@ endif LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.osx b/src/makefile.osx index 97264c7eb4..af52636919 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -35,6 +35,7 @@ CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offset HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -57,6 +58,7 @@ HEADERS = \ wallet.h OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.unix b/src/makefile.unix index 9e0b3263d7..a2cbc7c77e 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -73,6 +73,7 @@ CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(HARDENING) HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -95,6 +96,7 @@ HEADERS = \ wallet.h OBJS= \ + obj/checkpoints.o \ obj/crypter.o \ obj/db.o \ obj/init.o \ diff --git a/src/makefile.vc b/src/makefile.vc index a5437bcf5c..4c81cc400f 100644 --- a/src/makefile.vc +++ b/src/makefile.vc @@ -48,6 +48,7 @@ CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) HEADERS = \ base58.h \ bignum.h \ + checkpoints.h \ crypter.h \ db.h \ headers.h \ @@ -70,6 +71,7 @@ HEADERS = \ wallet.h OBJS= \ + obj\checkpoints.o \ obj\crypter.o \ obj\db.o \ obj\init.o \ @@ -98,6 +100,8 @@ all: bitcoin.exe .cpp{obj}.obj: cl $(CFLAGS) /DGUI /Fo$@ %s +obj\checkpoints.obj: $(HEADERS) + obj\util.obj: $(HEADERS) obj\script.obj: $(HEADERS) @@ -140,6 +144,8 @@ bitcoin.exe: $(OBJS) $(CRYPTOPP_OBJS) obj\ui.obj obj\uibase.obj obj\ui.res .cpp{obj\nogui}.obj: cl $(CFLAGS) /Fo$@ %s +obj\nogui\checkpoints.obj: $(HEADERS) + obj\nogui\util.obj: $(HEADERS) obj\nogui\script.obj: $(HEADERS) diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp new file mode 100644 index 0000000000..0d8a366d7a --- /dev/null +++ b/src/test/Checkpoints_tests.cpp @@ -0,0 +1,34 @@ +// +// Unit tests for block-chain checkpoints +// +#include // for 'map_list_of()' +#include +#include + +#include "../checkpoints.h" +#include "../util.h" + +using namespace std; + +BOOST_AUTO_TEST_SUITE(Checkpoints_tests) + +BOOST_AUTO_TEST_CASE(sanity) +{ + uint256 p11111 = uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); + uint256 p140700 = uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd"); + BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111)); + BOOST_CHECK(Checkpoints::CheckBlock(140700, p140700)); + + + // Wrong hashes at checkpoints should fail: + BOOST_CHECK(!Checkpoints::CheckBlock(11111, p140700)); + BOOST_CHECK(!Checkpoints::CheckBlock(140700, p11111)); + + // ... but any hash not at a checkpoint should succeed: + BOOST_CHECK(Checkpoints::CheckBlock(11111+1, p140700)); + BOOST_CHECK(Checkpoints::CheckBlock(140700+1, p11111)); + + BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 140700); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 0230bb6eca..645d8a2bdf 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -8,6 +8,7 @@ #include "uint256_tests.cpp" #include "script_tests.cpp" #include "transaction_tests.cpp" +#include "Checkpoints_tests.cpp" CWallet* pwalletMain; -- cgit v1.2.3 From 5d901f1ba0b2f4444e484b9cb3db8d86c428af3f Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 8 Sep 2011 12:51:43 -0400 Subject: Orphan block fill-up-memory attack prevention --- src/checkpoints.cpp | 32 +++++++++++++++++++++++++++----- src/checkpoints.h | 7 +++++++ src/main.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++--- src/main.h | 1 + 4 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 4419a06c83..c7e054df37 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -2,16 +2,23 @@ // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#include "checkpoints.h" -#include "uint256.h" -#include "util.h" - #include // for 'map_list_of()' +#include + +#include "headers.h" +#include "checkpoints.h" namespace Checkpoints { typedef std::map MapCheckpoints; + // + // What makes a good checkpoint block? + // + Is surrounded by blocks with reasonable timestamps + // (no blocks before with a timestamp after, none after with + // timestamp before) + // + Contains no strange transactions + // static MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) @@ -36,8 +43,23 @@ namespace Checkpoints int GetTotalBlocksEstimate() { - if (fTestNet) return 0; // Testnet has no checkpoints + if (fTestNet) return 0; return mapCheckpoints.rbegin()->first; } + + CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex) + { + if (fTestNet) return NULL; + + int64 nResult; + BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) + { + const uint256& hash = i.second; + std::map::const_iterator t = mapBlockIndex.find(hash); + if (t != mapBlockIndex.end()) + return t->second; + } + return NULL; + } } diff --git a/src/checkpoints.h b/src/checkpoints.h index 32094fdde6..9d52da404f 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -4,7 +4,11 @@ #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H +#include +#include "util.h" + class uint256; +class CBlockIndex; // // Block-chain checkpoints are compiled-in sanity checks. @@ -17,6 +21,9 @@ namespace Checkpoints // Return conservative estimate of total number of blocks, 0 if unknown int GetTotalBlocksEstimate(); + + // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint + CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex); } #endif diff --git a/src/main.cpp b/src/main.cpp index dad7d144e7..af00069d66 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -651,11 +651,32 @@ int64 static GetBlockValue(int nHeight, int64 nFees) return nSubsidy + nFees; } +static const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks +static const int64 nTargetSpacing = 10 * 60; +static const int64 nInterval = nTargetTimespan / nTargetSpacing; + +// +// minimum amount of work that could possibly be required nTime after +// minimum work required was nBase +// +unsigned int ComputeMinWork(unsigned int nBase, int64 nTime) +{ + CBigNum bnResult; + bnResult.SetCompact(nBase); + while (nTime > 0 && bnResult < bnProofOfWorkLimit) + { + // Maximum 400% adjustment... + bnResult *= 4; + // ... in best-case exactly 4-times-normal target time + nTime -= nTargetTimespan*4; + } + if (bnResult > bnProofOfWorkLimit) + bnResult = bnProofOfWorkLimit; + return bnResult.GetCompact(); +} + unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast) { - const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks - const int64 nTargetSpacing = 10 * 60; - const int64 nInterval = nTargetTimespan / nTargetSpacing; // Genesis block if (pindexLast == NULL) @@ -1317,6 +1338,26 @@ bool static ProcessBlock(CNode* pfrom, CBlock* pblock) if (!pblock->CheckBlock()) return error("ProcessBlock() : CheckBlock FAILED"); + CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); + if (pcheckpoint && pblock->hashPrevBlock != hashBestChain) + { + // Extra checks to prevent "fill up memory by spamming with bogus blocks" + int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; + if (deltaTime < 0) + { + return error("ProcessBlock() : block with timestamp before last checkpoint"); + } + CBigNum bnNewBlock; + bnNewBlock.SetCompact(pblock->nBits); + CBigNum bnRequired; + bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime)); + if (bnNewBlock > bnRequired) + { + return error("ProcessBlock() : block with too little proof-of-work"); + } + } + + // If don't already have its previous block, shunt it off to holding area until we get it if (!mapBlockIndex.count(pblock->hashPrevBlock)) { diff --git a/src/main.h b/src/main.h index f5e7f6c3e3..876a35d9cc 100644 --- a/src/main.h +++ b/src/main.h @@ -98,6 +98,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1); bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); bool CheckProofOfWork(uint256 hash, unsigned int nBits); +unsigned int ComputeMinWork(unsigned int nBase, int64 nTime); bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); -- cgit v1.2.3 From ba56a88ca5fae52ce5690553d97e4e8ac1338dfd Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 21 Nov 2011 12:25:00 -0500 Subject: Move DNS Seed lookup to a new thread. --- src/init.cpp | 5 ----- src/net.cpp | 39 ++++++++++++++++++++++++++++++++++++++- src/net.h | 1 - 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 68303c19fa..75ecfc574e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -519,11 +519,6 @@ bool AppInit2(int argc, char* argv[]) } } - if (GetBoolArg("-nodnsseed")) - printf("DNS seeding disabled\n"); - else - DNSAddressSeed(); - if (mapArgs.count("-paytxfee")) { if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee)) diff --git a/src/net.cpp b/src/net.cpp index f8f6afde54..1907397fad 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -32,6 +32,7 @@ void ThreadOpenConnections2(void* parg); #ifdef USE_UPNP void ThreadMapPort2(void* parg); #endif +void ThreadDNSAddressSeed2(void* parg); bool OpenNetworkConnection(const CAddress& addrConnect); @@ -1162,8 +1163,28 @@ static const char *strDNSSeed[] = { "dnsseed.bluematt.me", }; -void DNSAddressSeed() +void ThreadDNSAddressSeed(void* parg) { + IMPLEMENT_RANDOMIZE_STACK(ThreadDNSAddressSeed(parg)); + try + { + vnThreadsRunning[6]++; + ThreadDNSAddressSeed2(parg); + vnThreadsRunning[6]--; + } + catch (std::exception& e) { + vnThreadsRunning[6]--; + PrintException(&e, "ThreadDNSAddressSeed()"); + } catch (...) { + vnThreadsRunning[6]--; + throw; // support pthread_cancel() + } + printf("ThreadDNSAddressSeed exiting\n"); +} + +void ThreadDNSAddressSeed2(void* parg) +{ + printf("ThreadDNSAddressSeed started\n"); int found = 0; if (!fTestNet) @@ -1196,6 +1217,15 @@ void DNSAddressSeed() + + + + + + + + + unsigned int pnSeed[] = { 0x6884ac63, 0x3ffecead, 0x2919b953, 0x0942fe50, 0x7a1d922e, 0xcdd6734a, 0x953a5bb6, 0x2c46922e, @@ -1703,6 +1733,12 @@ void StartNode(void* parg) // Start threads // + if (GetBoolArg("-nodnsseed")) + printf("DNS seeding disabled\n"); + else + if (!CreateThread(ThreadDNSAddressSeed, NULL)) + printf("Error: CreateThread(ThreadDNSAddressSeed) failed\n"); + // Map ports with UPnP if (fHaveUPnP) MapPort(fUseUPnP); @@ -1749,6 +1785,7 @@ bool StopNode() if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n"); if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n"); if (fHaveUPnP && vnThreadsRunning[5] > 0) printf("ThreadMapPort still running\n"); + if (vnThreadsRunning[6] > 0) printf("ThreadDNSAddressSeed still running\n"); while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0) Sleep(20); Sleep(50); diff --git a/src/net.h b/src/net.h index 0026e402c2..741e2a812e 100644 --- a/src/net.h +++ b/src/net.h @@ -40,7 +40,6 @@ CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0); void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1); bool AnySubscribed(unsigned int nChannel); void MapPort(bool fMapPort); -void DNSAddressSeed(); bool BindListenPort(std::string& strError=REF(std::string())); void StartNode(void* parg); bool StopNode(); -- cgit v1.2.3 From 16e7c05de71a2c215e3b74522bf34d8e0da3381e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 3 Dec 2011 21:48:32 -0500 Subject: Move -lgdi32 after -lcrypto (fixes #681). --- bitcoin-qt.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 8fc177f7f4..66b53c2367 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -251,7 +251,7 @@ isEmpty(BOOST_INCLUDE_PATH) { macx:BOOST_INCLUDE_PATH = /opt/local/include } -windows:LIBS += -lws2_32 -lgdi32 +windows:LIBS += -lws2_32 windows:DEFINES += WIN32 windows:RC_FILE = src/qt/res/bitcoin-qt.rc @@ -266,6 +266,8 @@ macx:TARGET = "Bitcoin-Qt" INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX +# -lgdi32 has to happen after -lcrypto (see #681) +windows:LIBS += -lgdi32 LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX contains(RELEASE, 1) { -- cgit v1.2.3 From 9a7f4948c6e63e9470b14b0f8b61c8ecbf21f00f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 7 Dec 2011 10:26:55 -0500 Subject: Re-enable RPCSSL in gitian builds. --- contrib/gitian-descriptors/gitian-win32.yml | 4 ++-- contrib/gitian-descriptors/gitian.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml index 37dcb8d0b5..0f4670979e 100644 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -71,7 +71,7 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin + $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross USE_SSL=1 MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin make $MAKEOPTS cp release/bitcoin-qt.exe $OUTDIR/ # @@ -80,7 +80,7 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0 + make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_SSL=1 USE_UPNP=0 i586-mingw32msvc-strip bitcoind.exe makensis ../share/setup.nsi cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/ diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index 84ecac6ff4..47164b0afd 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -39,10 +39,10 @@ script: | cp $OUTDIR/src/COPYING $OUTDIR cd src sed 's/$(DEBUGFLAGS)//' -i makefile.unix - make -f makefile.unix STATIC=1 DEFS="-I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 + make -f makefile.unix STATIC=1 DEFS="-I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 USE_SSL=1 mkdir -p $OUTDIR/bin/$GBUILD_BITS install -s bitcoind $OUTDIR/bin/$GBUILD_BITS cd .. - qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 + qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_SSL=1 make $MAKEOPTS install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS -- cgit v1.2.3 From 142e5056cd8a62df838e9a3afee0f718faffd72b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 13 Dec 2011 16:28:56 +0100 Subject: Enable wordwrap for long message in passphrase dialog - Remove explicit resizing from constructor to prevent potential hang --- src/qt/askpassphrasedialog.cpp | 1 - src/qt/forms/askpassphrasedialog.ui | 20 +++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index a574ef925b..b52acf4545 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -47,7 +47,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) : ui->warningLabel->setText(tr("Enter the old and new passphrase to the wallet.")); break; } - resize(minimumSize()); // Get rid of extra space in dialog textChanged(); connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui index 70d9180e75..3c7dac5f8d 100644 --- a/src/qt/forms/askpassphrasedialog.ui +++ b/src/qt/forms/askpassphrasedialog.ui @@ -6,8 +6,8 @@ 0 0 - 589 - 228 + 598 + 187 @@ -34,6 +34,9 @@ Qt::RichText + + true + @@ -85,19 +88,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - -- cgit v1.2.3 From 181b863d224b5236b53309e7cb12b3927b240d70 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 13 Dec 2011 14:00:21 -0500 Subject: Fix status bar not displaying Alerts. --- src/qt/bitcoin.cpp | 2 ++ src/qt/bitcoingui.cpp | 40 +++++++++++++++++++++++++++++++++++----- src/qt/bitcoingui.h | 2 ++ src/qt/clientmodel.cpp | 5 +++++ src/qt/clientmodel.h | 2 ++ 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 6afa9671d0..2142db5a36 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -91,6 +91,8 @@ void UIThreadCall(boost::function0 fn) void MainFrameRepaint() { + if(guiref) + QMetaObject::invokeMethod(guiref, "refreshStatusBar", Qt::QueuedConnection); } void InitMessage(const std::string &message) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 8641c723b0..5968aab6c4 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -2,6 +2,7 @@ * Qt4 bitcoin GUI. * * W.J. van der Laan 2011 + * The Bitcoin Developers 2011 */ #include "bitcoingui.h" #include "transactiontablemodel.h" @@ -412,15 +413,31 @@ void BitcoinGUI::setNumBlocks(int count) if(count < total) { - progressBarLabel->setVisible(true); - progressBar->setVisible(true); - progressBar->setMaximum(total - initTotal); - progressBar->setValue(count - initTotal); + if (clientModel->getStatusBarWarnings() == "") + { + progressBarLabel->setVisible(true); + progressBarLabel->setText(tr("Synchronizing with network...")); + progressBar->setVisible(true); + progressBar->setMaximum(total - initTotal); + progressBar->setValue(count - initTotal); + } + else + { + progressBarLabel->setText(clientModel->getStatusBarWarnings()); + progressBarLabel->setVisible(true); + progressBar->setVisible(false); + } tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total); } else { - progressBarLabel->setVisible(false); + if (clientModel->getStatusBarWarnings() == "") + progressBarLabel->setVisible(false); + else + { + progressBarLabel->setText(clientModel->getStatusBarWarnings()); + progressBarLabel->setVisible(true); + } progressBar->setVisible(false); tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count); } @@ -469,6 +486,19 @@ void BitcoinGUI::setNumBlocks(int count) progressBar->setToolTip(tooltip); } +void BitcoinGUI::refreshStatusBar() +{ + /* Might display multiple times in the case of multiple alerts + static QString prevStatusBar; + QString newStatusBar = clientModel->getStatusBarWarnings(); + if (prevStatusBar != newStatusBar) + { + prevStatusBar = newStatusBar; + error(tr("Network Alert"), newStatusBar); + }*/ + setNumBlocks(clientModel->getNumBlocks()); +} + void BitcoinGUI::error(const QString &title, const QString &message) { // Report errors from network/worker thread diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index a912192196..581d393749 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -96,6 +96,8 @@ public slots: void setNumConnections(int count); void setNumBlocks(int count); void setEncryptionStatus(int status); + /** Set the status bar text if there are any warnings (removes sync progress bar if applicable) */ + void refreshStatusBar(); void error(const QString &title, const QString &message); /* It is currently not possible to pass a return value to another thread through diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 2ed3ce51df..5a0b4aa83c 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -72,6 +72,11 @@ int ClientModel::getNumBlocksOfPeers() const return GetNumBlocksOfPeers(); } +QString ClientModel::getStatusBarWarnings() const +{ + return QString::fromStdString(GetWarnings("statusbar")); +} + OptionsModel *ClientModel::getOptionsModel() { return optionsModel; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index c68fb0f035..0b7c16d7a9 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -33,6 +33,8 @@ public: bool inInitialBlockDownload() const; // Return conservative estimate of total number of blocks, or 0 if unknown int getNumBlocksOfPeers() const; + //! Return warnings to be displayed in status bar + QString getStatusBarWarnings() const; QString formatFullVersion() const; -- cgit v1.2.3 From 1f53204045313eb0243c7b2372d241105c257ca2 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 15 Dec 2011 19:25:29 -0500 Subject: Bump version to 0.4.3 --- 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 9145db10f1..1d520c93cf 100644 --- a/contrib/Bitcoin.app/Contents/Info.plist +++ b/contrib/Bitcoin.app/Contents/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4.2 + 0.4.3 CFBundleSignature ???? CFBundleVersion diff --git a/doc/README b/doc/README index 9c28f4c692..d91509bd90 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.4.2 BETA +Bitcoin 0.4.3 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 7a406d65a3..2f5761645a 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.4.2 BETA +Bitcoin 0.4.3 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 4500dc48e1..3455f7681c 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.2 +!define VERSION 0.4.3 !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.2-win32-setup.exe +OutFile bitcoin-0.4.3-win32-setup.exe InstallDir $PROGRAMFILES\Bitcoin CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion 0.4.2.0 +VIProductVersion 0.4.3.0 VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/src/serialize.h b/src/serialize.h index 64fae0367e..7876990d04 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 = 40200; +static const int VERSION = 40300; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; -- cgit v1.2.3 From ace5ce05bef68722a060d6ec6e7d1fbf307d9835 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 15 Dec 2011 19:34:37 -0500 Subject: Bump version to 0.5.0.3 --- bitcoin-qt.pro | 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/bitcoin-qt.pro b/bitcoin-qt.pro index 65a31f6d68..1eddcd542b 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -1,6 +1,6 @@ TEMPLATE = app TARGET = -VERSION = 0.5.0.2 +VERSION = 0.5.0.3 INCLUDEPATH += src src/json src/qt DEFINES += QT_GUI BOOST_THREAD_USE_LIB CONFIG += no_include_pwd diff --git a/doc/README b/doc/README index ab19734d1d..c3ed9c4b7e 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.5.0.2 BETA +Bitcoin 0.5.0.3 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 d54f18ec62..8a8f82b846 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.5.0.2 BETA +Bitcoin 0.5.0.3 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 2674597ee1..76efe57d27 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.5.0.2 +!define VERSION 0.5.0.3 !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.5.0.2-win32-setup.exe +OutFile bitcoin-0.5.0.3-win32-setup.exe InstallDir $PROGRAMFILES\Bitcoin CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion 0.5.0.2 +VIProductVersion 0.5.0.3 VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/src/serialize.h b/src/serialize.h index d1296ed68f..fdfd6346e9 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -60,7 +60,7 @@ class CDataStream; class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -static const int VERSION = 50002; +static const int VERSION = 50003; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; -- cgit v1.2.3 From 5fe2dbd7b6a182b90128371f8e8d679d70133d6b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 16 Dec 2011 17:47:50 -0500 Subject: Update debian changelog to 0.5.0.3. --- contrib/debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/debian/changelog b/contrib/debian/changelog index 6355141036..bef58c982f 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,9 @@ +bitcoin (0.5.0.3-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Fri, 16 Dec 2011 13:27:00 -0500 + bitcoin (0.5.0-natty0) natty; urgency=low * New upstream release. -- cgit v1.2.3