From 9858c733c641f97b9905f073788b31edc98f8b70 Mon Sep 17 00:00:00 2001 From: RickiNano <81099017+RickiNano@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:44:05 +0100 Subject: [PATCH] Exit migration if existing rocksdb ledger found --- nano/secure/ledger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nano/secure/ledger.cpp b/nano/secure/ledger.cpp index 4533eddccd..000855d77f 100644 --- a/nano/secure/ledger.cpp +++ b/nano/secure/ledger.cpp @@ -1280,7 +1280,12 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p boost::system::error_code error_chmod; nano::set_secure_perm_directory (data_path_a, error_chmod); auto rockdb_data_path = data_path_a / "rocksdb"; - std::filesystem::remove_all (rockdb_data_path); + + if (std::filesystem::exists (rockdb_data_path)) + { + logger.error (nano::log::type::ledger, "Existing Rocksdb folder found in '{}'. Please remove it and try again.", rockdb_data_path.string ()); + return true; + } auto error (false);