From c09dfd06fc2d183b996503d29da502ab0b49cb26 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 21 Jun 2015 17:49:50 +0200 Subject: Revert "Disable partition check for now, it triggers too often (issue #6251)" Re-enable partition check, it should be safe again after #6256. This reverts commit 3eada74d6f4720e650c67461c04c3aafdeaff21e. --- src/init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/init.cpp b/src/init.cpp index fa8e4317e..a49406ec1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1420,13 +1420,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) #endif StartNode(threadGroup, scheduler); -#if 0 // Disable partition check for now, it triggers too often (issue #6251) + // Monitor the chain, and alert if we get blocks much quicker or slower than expected int64_t nPowTargetSpacing = Params().GetConsensus().nPowTargetSpacing; CScheduler::Function f = boost::bind(&PartitionCheck, &IsInitialBlockDownload, boost::ref(cs_main), boost::cref(pindexBestHeader), nPowTargetSpacing); scheduler.scheduleEvery(f, nPowTargetSpacing); -#endif + #ifdef ENABLE_WALLET // Generate coins in the background if (pwalletMain) -- cgit v1.2.3 From e44aaef534d7e0553db23988f0bd732319251031 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 7 Jun 2015 04:38:31 +0300 Subject: Add an alternate location of endian.h header Github-Pull: #6246 Rebased-From: 0640a5eb60b06de61f873fd88ae0252f5a11c339 --- src/compat/endian.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/compat/endian.h b/src/compat/endian.h index 4d041d655..9fec2a07f 100644 --- a/src/compat/endian.h +++ b/src/compat/endian.h @@ -15,6 +15,8 @@ #if defined(HAVE_ENDIAN_H) #include +#elif defined(HAVE_SYS_ENDIAN_H) +#include #endif #if defined(WORDS_BIGENDIAN) -- cgit v1.2.3 From a46370f7917fea7210d85c7a594642fb9d93a0ea Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Mon, 15 Jun 2015 07:46:51 +0200 Subject: fix crash on shutdown when e.g. changing -txindex and abort action - fixes #3136 - the problem is related to Boost path and a static initialized internal pointer - using a std::string in CDBEnv::EnvShutdown() prevents the problem - this removes the boost::filesystem::path path field from CDBEnv Github-Pull: #6282 Rebased-From: 0ce30eaa36295447c6e7f8d16a05798c746fe28a --- src/wallet/db.cpp | 12 ++++++------ src/wallet/db.h | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 53cfcf096..e5bc653c3 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -43,7 +43,7 @@ void CDBEnv::EnvShutdown() if (ret != 0) LogPrintf("CDBEnv::EnvShutdown: Error %d shutting down database environment: %s\n", ret, DbEnv::strerror(ret)); if (!fMockDb) - DbEnv(0).remove(path.string().c_str(), 0); + DbEnv(0).remove(strPath.c_str(), 0); } void CDBEnv::Reset() @@ -78,10 +78,10 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn) boost::this_thread::interruption_point(); - path = pathIn; - boost::filesystem::path pathLogDir = path / "database"; + strPath = pathIn.string(); + boost::filesystem::path pathLogDir = pathIn / "database"; TryCreateDirectory(pathLogDir); - boost::filesystem::path pathErrorFile = path / "db.log"; + boost::filesystem::path pathErrorFile = pathIn / "db.log"; LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string()); unsigned int nEnvFlags = 0; @@ -98,7 +98,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn) dbenv->set_flags(DB_AUTO_COMMIT, 1); dbenv->set_flags(DB_TXN_WRITE_NOSYNC, 1); dbenv->log_set_config(DB_LOG_AUTO_REMOVE, 1); - int ret = dbenv->open(path.string().c_str(), + int ret = dbenv->open(strPath.c_str(), DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | @@ -455,7 +455,7 @@ void CDBEnv::Flush(bool fShutdown) dbenv->log_archive(&listp, DB_ARCH_REMOVE); Close(); if (!fMockDb) - boost::filesystem::remove_all(path / "database"); + boost::filesystem::remove_all(boost::filesystem::path(strPath) / "database"); } } } diff --git a/src/wallet/db.h b/src/wallet/db.h index 2df6f6e5a..64071caa3 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -27,7 +27,9 @@ class CDBEnv private: bool fDbEnvInit; bool fMockDb; - boost::filesystem::path path; + // Don't change into boost::filesystem::path, as that can result in + // shutdown problems/crashes caused by a static initialized internal pointer. + std::string strPath; void EnvShutdown(); -- cgit v1.2.3 From fc1f115ee55e6a4972b88e168e78a6533512076d Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Thu, 4 Jun 2015 13:00:26 -0400 Subject: Advance pindexLastCommonBlock for blocks in chainActive This prevents an edge case where a block downloaded and pruned in-between successive calls to FindNextBlocksToDownload could cause the block to be unnecessarily re-requested. Github-Pull: #6233 Rebased-From: 3e9143386a90e508c8d41719294db11264f5f0a0 --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index ded32eb03..cd4670254 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -436,13 +436,14 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vectorIsValid(BLOCK_VALID_TREE)) { // We consider the chain that this peer is on invalid. return; } - if (pindex->nStatus & BLOCK_HAVE_DATA) { + if (pindex->nStatus & BLOCK_HAVE_DATA || chainActive.Contains(pindex)) { if (pindex->nChainTx) state->pindexLastCommonBlock = pindex; } else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) { -- cgit v1.2.3