From 471e8a31959d2e0c7a4ed2ca0af5f6a3268e6235 Mon Sep 17 00:00:00 2001 From: warptangent Date: Fri, 14 Aug 2015 14:55:03 -0700 Subject: [PATCH] blockchain_import: Add --input-file option This option specifies the input file path for importing. The default remains /export/blockchain.raw --- src/blockchain_utilities/blockchain_import.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index 7fab8ca95..88d748411 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -544,6 +544,7 @@ int main(int argc, char* argv[]) po::options_description desc_cmd_only("Command line options"); po::options_description desc_cmd_sett("Command line options and settings options"); + const command_line::arg_descriptor arg_input_file = {"input-file", "Specify input file", "", true}; const command_line::arg_descriptor arg_log_level = {"log-level", "", log_level}; const command_line::arg_descriptor arg_block_stop = {"block-stop", "Stop at block number", block_stop}; const command_line::arg_descriptor arg_batch_size = {"batch-size", "", db_batch_size}; @@ -571,6 +572,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_cmd_sett, command_line::arg_data_dir, default_data_path.string()); command_line::add_arg(desc_cmd_sett, command_line::arg_testnet_data_dir, default_testnet_data_path.string()); + command_line::add_arg(desc_cmd_sett, arg_input_file); command_line::add_arg(desc_cmd_sett, arg_testnet_on); command_line::add_arg(desc_cmd_sett, arg_log_level); command_line::add_arg(desc_cmd_sett, arg_database); @@ -651,7 +653,13 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("Starting..."); LOG_PRINT_L0("Setting log level = " << log_level); - boost::filesystem::path fs_import_file_path = boost::filesystem::path(m_config_folder) / "export" / BLOCKCHAIN_RAW; + boost::filesystem::path fs_import_file_path; + + if (command_line::has_arg(vm, arg_input_file)) + fs_import_file_path = boost::filesystem::path(command_line::get_arg(vm, arg_input_file)); + else + fs_import_file_path = boost::filesystem::path(m_config_folder) / "export" / BLOCKCHAIN_RAW; + import_file_path = fs_import_file_path.string(); if (command_line::has_arg(vm, arg_count_blocks))