aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/BlockchainDB_impl
diff options
context:
space:
mode:
authorwarptangent <warptangent@inbox.com>2015-02-19 06:37:00 -0800
committerwarptangent <warptangent@inbox.com>2015-02-23 00:33:37 -0800
commitce71abd0fe9739c3557ba5fce446d1244670976f (patch)
tree4c2706b523e60d52a618ec9817d912c32607d163 /src/cryptonote_core/BlockchainDB_impl
parentFix formatting (diff)
downloadmonero-ce71abd0fe9739c3557ba5fce446d1244670976f.tar.xz
Move LMDB storage to subfolder
Diffstat (limited to 'src/cryptonote_core/BlockchainDB_impl')
-rw-r--r--src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
index 9f6bc6b31..f7e8c5dda 100644
--- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
+++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
@@ -630,6 +630,16 @@ void BlockchainLMDB::open(const std::string& filename)
throw0(DB_OPEN_FAILURE(std::string("Failed to create directory ").append(filename).c_str()));
}
+ // check for existing LMDB files in base directory
+ boost::filesystem::path old_files = direc.parent_path();
+ if (boost::filesystem::exists(old_files / "data.mdb") ||
+ boost::filesystem::exists(old_files / "lock.mdb"))
+ {
+ LOG_PRINT_L0("Found existing LMDB files in " << old_files.c_str());
+ LOG_PRINT_L0("Move data.mdb and/or lock.mdb to " << filename << ", or delete them, and then restart");
+ throw DB_ERROR("Database could not be opened");
+ }
+
m_folder = filename;
// set up lmdb environment