diff options
author | warptangent <warptangent@inbox.com> | 2015-02-19 06:37:00 -0800 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-02-23 00:33:37 -0800 |
commit | ce71abd0fe9739c3557ba5fce446d1244670976f (patch) | |
tree | 4c2706b523e60d52a618ec9817d912c32607d163 /src/cryptonote_core | |
parent | Fix formatting (diff) | |
download | monero-ce71abd0fe9739c3557ba5fce446d1244670976f.tar.xz |
Move LMDB storage to subfolder
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp | 10 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 3 |
2 files changed, 12 insertions, 1 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 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index b4b1a4c86..b2d979432 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -237,8 +237,9 @@ bool Blockchain::init(const std::string& config_folder, bool testnet) m_testnet = testnet; boost::filesystem::path folder(m_config_folder); + folder /= "lmdb"; - LOG_PRINT_L0("Loading blockchain..."); + LOG_PRINT_L0("Loading blockchain from folder " << folder.c_str() << " ..."); //FIXME: update filename for BlockchainDB const std::string filename = folder.string(); |