aboutsummaryrefslogtreecommitdiff
path: root/src/index/base.cpp
diff options
context:
space:
mode:
authorJim Posen <jim.posen@gmail.com>2018-05-15 17:20:17 -0700
committerJim Posen <jim.posen@gmail.com>2018-06-04 19:22:30 -0700
commitec3073a274bf7affe1b8c87a10f75d126f5ac027 (patch)
tree9f56192c49d79d2c23a5618b8b663926bc1b9fb2 /src/index/base.cpp
parent89eddcd365e9a2218648f5cc5b9f22b28023f50a (diff)
index: Move index DBs into index/ directory.
Diffstat (limited to 'src/index/base.cpp')
-rw-r--r--src/index/base.cpp20
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();