aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorJim Posen <jim.posen@gmail.com>2018-05-15 14:57:22 -0700
committerJim Posen <jim.posen@gmail.com>2018-06-04 19:22:21 -0700
commite5af5fc6fb4658599b940d1d50853129b31b8766 (patch)
tree49a664e962fe76d77e22364750cf6ca3dd0d74db /src/txdb.cpp
parent9b0ec1a7f9ffae816fd5ca32ff7e7559640b6f6d (diff)
downloadbitcoin-e5af5fc6fb4658599b940d1d50853129b31b8766.tar.xz
db: Make reusable base class for index databases.
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 90d937d4c0..624b23962a 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -415,8 +415,12 @@ bool CCoinsViewDB::Upgrade() {
return !ShutdownRequested();
}
+BaseIndexDB::BaseIndexDB(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)
+{}
+
TxIndexDB::TxIndexDB(size_t n_cache_size, bool f_memory, bool f_wipe) :
- CDBWrapper(GetDataDir() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe)
+ BaseIndexDB(GetDataDir() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe)
{}
bool TxIndexDB::ReadTxPos(const uint256 &txid, CDiskTxPos& pos) const
@@ -433,7 +437,7 @@ bool TxIndexDB::WriteTxs(const std::vector<std::pair<uint256, CDiskTxPos>>& v_po
return WriteBatch(batch);
}
-bool TxIndexDB::ReadBestBlock(CBlockLocator& locator) const
+bool BaseIndexDB::ReadBestBlock(CBlockLocator& locator) const
{
bool success = Read(DB_BEST_BLOCK, locator);
if (!success) {
@@ -442,7 +446,7 @@ bool TxIndexDB::ReadBestBlock(CBlockLocator& locator) const
return success;
}
-bool TxIndexDB::WriteBestBlock(const CBlockLocator& locator)
+bool BaseIndexDB::WriteBestBlock(const CBlockLocator& locator)
{
return Write(DB_BEST_BLOCK, locator);
}