aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dbwrapper.cpp5
-rw-r--r--src/dbwrapper.h9
-rw-r--r--src/validation.cpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp
index 2aade14ef4..05d24f7507 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -27,6 +27,11 @@
#include <memory>
#include <optional>
+bool DestroyDB(const std::string& path_str)
+{
+ return leveldb::DestroyDB(path_str, {}).ok();
+}
+
class CBitcoinLevelDBLogger : public leveldb::Logger {
public:
// This code is adapted from posix_logger.h, which is why it is using vsprintf.
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 4ae2106211..478b73d56f 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -21,6 +21,7 @@
#include <leveldb/slice.h>
#include <leveldb/status.h>
#include <leveldb/write_batch.h>
+#include <optional>
#include <stdexcept>
#include <string>
#include <vector>
@@ -64,10 +65,6 @@ public:
class CDBWrapper;
-namespace dbwrapper {
- using leveldb::DestroyDB;
-}
-
/** These should be considered an implementation detail of the specific database.
*/
namespace dbwrapper_private {
@@ -82,7 +79,9 @@ void HandleError(const leveldb::Status& status);
*/
const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w);
-};
+}; // namespace dbwrapper_private
+
+bool DestroyDB(const std::string& path_str);
/** Batch of changes queued to be written to a CDBWrapper */
class CDBBatch
diff --git a/src/validation.cpp b/src/validation.cpp
index e6def01db5..e4b5381f00 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5027,7 +5027,7 @@ static bool DeleteCoinsDBFromDisk(const fs::path db_path, bool is_snapshot)
// We have to destruct before this call leveldb::DB in order to release the db
// lock, otherwise `DestroyDB` will fail. See `leveldb::~DBImpl()`.
- const bool destroyed = dbwrapper::DestroyDB(path_str, {}).ok();
+ const bool destroyed = DestroyDB(path_str);
if (!destroyed) {
LogPrintf("error: leveldb DestroyDB call failed on %s\n", path_str);