Changeset View
Changeset View
Standalone View
Standalone View
src/index/base.cpp
// Copyright (c) 2017-2018 The Bitcoin Core developers | // Copyright (c) 2017-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <blockdb.h> | #include <blockdb.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <index/base.h> | #include <index/base.h> | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/translation.h> | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <warnings.h> | #include <warnings.h> | ||||
constexpr char DB_BEST_BLOCK = 'B'; | constexpr char DB_BEST_BLOCK = 'B'; | ||||
constexpr int64_t SYNC_LOG_INTERVAL = 30; // seconds | constexpr int64_t SYNC_LOG_INTERVAL = 30; // seconds | ||||
constexpr int64_t SYNC_LOCATOR_WRITE_INTERVAL = 30; // seconds | constexpr int64_t SYNC_LOCATOR_WRITE_INTERVAL = 30; // seconds | ||||
template <typename... Args> | template <typename... Args> | ||||
static void FatalError(const char *fmt, const Args &... args) { | static void FatalError(const char *fmt, const Args &... args) { | ||||
std::string strMessage = tfm::format(fmt, args...); | std::string strMessage = tfm::format(fmt, args...); | ||||
SetMiscWarning(strMessage); | SetMiscWarning(strMessage); | ||||
LogPrintf("*** %s\n", strMessage); | LogPrintf("*** %s\n", strMessage); | ||||
uiInterface.ThreadSafeMessageBox( | uiInterface.ThreadSafeMessageBox( | ||||
"Error: A fatal internal error occurred, see debug.log for details", "", | Untranslated("Error: A fatal internal error occurred, see debug.log " | ||||
CClientUIInterface::MSG_ERROR); | "for details"), | ||||
"", CClientUIInterface::MSG_ERROR); | |||||
StartShutdown(); | StartShutdown(); | ||||
} | } | ||||
BaseIndex::DB::DB(const fs::path &path, size_t n_cache_size, bool f_memory, | BaseIndex::DB::DB(const fs::path &path, size_t n_cache_size, bool f_memory, | ||||
bool f_wipe, bool f_obfuscate) | bool f_wipe, bool f_obfuscate) | ||||
: CDBWrapper(path, n_cache_size, f_memory, f_wipe, f_obfuscate) {} | : CDBWrapper(path, n_cache_size, f_memory, f_wipe, f_obfuscate) {} | ||||
bool BaseIndex::DB::ReadBestBlock(CBlockLocator &locator) const { | bool BaseIndex::DB::ReadBestBlock(CBlockLocator &locator) const { | ||||
▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines |