diff options
Diffstat (limited to 'src/index/base.cpp')
-rw-r--r-- | src/index/base.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp index f381681a64..738166dc94 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -11,6 +11,8 @@ #include <validation.h> #include <warnings.h> +constexpr char DB_BEST_BLOCK = 'B'; + constexpr int64_t SYNC_LOG_INTERVAL = 30; // seconds constexpr int64_t SYNC_LOCATOR_WRITE_INTERVAL = 30; // seconds @@ -26,6 +28,24 @@ static void FatalError(const char* fmt, const Args&... args) StartShutdown(); } +BaseIndex::DB::DB(const fs::path& path, size_t n_cache_size, bool f_memory, bool f_wipe, bool f_obfuscate) : + CDBWrapper(path, n_cache_size, f_memory, f_wipe, f_obfuscate) +{} + +bool BaseIndex::DB::ReadBestBlock(CBlockLocator& locator) const +{ + bool success = Read(DB_BEST_BLOCK, locator); + if (!success) { + locator.SetNull(); + } + return success; +} + +bool BaseIndex::DB::WriteBestBlock(const CBlockLocator& locator) +{ + return Write(DB_BEST_BLOCK, locator); +} + BaseIndex::~BaseIndex() { Interrupt(); |