diff options
author | warptangent <warptangent@inbox.com> | 2015-08-14 14:49:46 -0700 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-08-14 15:00:18 -0700 |
commit | 3ffda6eefbc89ec0ddfc49e6230c473b23a6d16e (patch) | |
tree | 3b56000f2bc3ca0bc5ec814f7be51276a994c30a /src | |
parent | Merge pull request #374 (diff) | |
download | monero-3ffda6eefbc89ec0ddfc49e6230c473b23a6d16e.tar.xz |
blockchain_import: Updates for naming consistency
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_utilities/blockchain_import.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index 924b46d2d..7fab8ca95 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -173,7 +173,7 @@ int pop_blocks(FakeCore& simple_core, int num_blocks) } template <typename FakeCore> -int import_from_file(FakeCore& simple_core, std::string& import_file_path, uint64_t block_stop=0) +int import_from_file(FakeCore& simple_core, const std::string& import_file_path, uint64_t block_stop=0) { #if !defined(BLOCKCHAIN_DB) static_assert(std::is_same<fake_core_memory, FakeCore>::value || std::is_same<fake_core_lmdb, FakeCore>::value, @@ -188,11 +188,11 @@ int import_from_file(FakeCore& simple_core, std::string& import_file_path, uint6 simple_core.m_storage.get_db().reset_stats(); } #endif - boost::filesystem::path raw_file_path(import_file_path); + boost::filesystem::path fs_import_file_path(import_file_path); boost::system::error_code ec; - if (!boost::filesystem::exists(raw_file_path, ec)) + if (!boost::filesystem::exists(fs_import_file_path, ec)) { - LOG_PRINT_L0("bootstrap file not found: " << raw_file_path); + LOG_PRINT_L0("bootstrap file not found: " << fs_import_file_path); return false; } @@ -526,7 +526,6 @@ int import_from_file(FakeCore& simple_core, std::string& import_file_path, uint6 int main(int argc, char* argv[]) { - std::string import_filename = BLOCKCHAIN_RAW; #if defined(BLOCKCHAIN_DB) && (BLOCKCHAIN_DB == DB_MEMORY) std::string default_db_engine = "memory"; #else @@ -536,11 +535,12 @@ int main(int argc, char* argv[]) uint32_t log_level = LOG_LEVEL_0; uint64_t num_blocks = 0; uint64_t block_stop = 0; - std::string dirname; + std::string m_config_folder; std::string db_arg_str; boost::filesystem::path default_data_path {tools::get_default_data_dir()}; boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"}; + std::string import_file_path; po::options_description desc_cmd_only("Command line options"); po::options_description desc_cmd_sett("Command line options and settings options"); @@ -643,7 +643,7 @@ int main(int argc, char* argv[]) opt_testnet = command_line::get_arg(vm, arg_testnet_on); auto data_dir_arg = opt_testnet ? command_line::arg_testnet_data_dir : command_line::arg_data_dir; - dirname = command_line::get_arg(vm, data_dir_arg); + m_config_folder = command_line::get_arg(vm, data_dir_arg); db_arg_str = command_line::get_arg(vm, arg_database); log_space::get_set_log_detalisation_level(true, log_level); @@ -651,10 +651,9 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("Starting..."); LOG_PRINT_L0("Setting log level = " << log_level); - boost::filesystem::path file_path {dirname}; - std::string import_file_path; + boost::filesystem::path fs_import_file_path = boost::filesystem::path(m_config_folder) / "export" / BLOCKCHAIN_RAW; + import_file_path = fs_import_file_path.string(); - import_file_path = (file_path / "export" / import_filename).string(); if (command_line::has_arg(vm, arg_count_blocks)) { BootstrapFile bootstrap; @@ -694,7 +693,7 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("testnet: " << std::boolalpha << opt_testnet << std::noboolalpha); LOG_PRINT_L0("bootstrap file path: " << import_file_path); - LOG_PRINT_L0("database path: " << file_path.string()); + LOG_PRINT_L0("database path: " << m_config_folder); try { @@ -710,12 +709,12 @@ int main(int argc, char* argv[]) #if !defined(BLOCKCHAIN_DB) if (db_engine == "lmdb") { - fake_core_lmdb simple_core(dirname, opt_testnet, opt_batch, mdb_flags); + fake_core_lmdb simple_core(m_config_folder, opt_testnet, opt_batch, mdb_flags); import_from_file(simple_core, import_file_path, block_stop); } else if (db_engine == "memory") { - fake_core_memory simple_core(dirname, opt_testnet); + fake_core_memory simple_core(m_config_folder, opt_testnet); import_from_file(simple_core, import_file_path, block_stop); } else @@ -732,9 +731,9 @@ int main(int argc, char* argv[]) return 1; } #if BLOCKCHAIN_DB == DB_LMDB - fake_core_lmdb simple_core(dirname, opt_testnet, opt_batch, mdb_flags); + fake_core_lmdb simple_core(m_config_folder, opt_testnet, opt_batch, mdb_flags); #else - fake_core_memory simple_core(dirname, opt_testnet); + fake_core_memory simple_core(m_config_folder, opt_testnet); #endif if (! vm["pop-blocks"].defaulted()) |