688 available_dbs =
"available: " + available_dbs;
700 po::options_description desc_cmd_only(
"Command line options");
701 po::options_description desc_cmd_sett(
"Command line options and settings options");
710 ,
"Count blocks in bootstrap file and exit" 714 "database", available_dbs.c_str(), default_db_type
717 "Blindly trust the import file and use potentially malicious blocks and transactions during import (only enable if you exported the file yourself)",
false};
719 "Batch transactions for faster import",
true};
721 "Resume from current height if output database already exists",
true};
736 desc_cmd_sett.add_options()
737 (arg_noverify.name,
make_semantic(arg_noverify), arg_noverify.description)
738 (arg_batch.name,
make_semantic(arg_batch), arg_batch.description)
739 (arg_resume.name,
make_semantic(arg_resume), arg_resume.description)
742 po::options_description desc_options(
"Allowed options");
743 desc_options.add(desc_cmd_only).add(desc_cmd_sett);
746 po::variables_map vm;
765 std::cout << desc_options << std::endl;
771 std::cerr <<
"Error: batch-size set, but batch option not enabled" <<
ENDL;
776 std::cerr <<
"Error: batch-size must be > 0" <<
ENDL;
786 if (db_batch_size > db_batch_size_verify)
788 db_batch_size = db_batch_size_verify;
794 if (opt_testnet && opt_stagenet)
796 std::cerr <<
"Error: Can't specify more than one of --testnet and --stagenet" <<
ENDL;
808 MINFO(
"Starting...");
810 boost::filesystem::path fs_import_file_path;
815 fs_import_file_path = boost::filesystem::path(m_config_folder) /
"export" /
BLOCKCHAIN_RAW;
817 import_file_path = fs_import_file_path.string();
833 std::cerr <<
"Error parsing database argument(s)" <<
ENDL;
839 std::cerr <<
"Invalid database type: " << db_type << std::endl;
843 MINFO(
"database: " << db_type);
844 MINFO(
"database flags: " << db_flags);
845 MINFO(
"verify: " << std::boolalpha << opt_verify << std::noboolalpha);
848 MINFO(
"batch: " << std::boolalpha << opt_batch << std::noboolalpha
849 <<
" batch size: " << db_batch_size);
853 MINFO(
"batch: " << std::boolalpha << opt_batch << std::noboolalpha);
855 MINFO(
"resume: " << std::boolalpha << opt_resume << std::noboolalpha);
856 MINFO(
"nettype: " << (opt_testnet ?
"testnet" : opt_stagenet ?
"stagenet" :
"mainnet"));
858 MINFO(
"bootstrap file path: " << import_file_path);
859 MINFO(
"database path: " << m_config_folder);
864 "Import is set to proceed WITHOUT VERIFICATION.\n" 865 "This is a DANGEROUS operation: if the file was tampered with in transit, or obtained from a malicious source,\n" 866 "you could end up with a compromised database. It is recommended to NOT use " << arg_noverify.name <<
".\n" 867 "*****************************************************************************************\n" 868 "You have 90 seconds to press ^C or terminate this program before unverified import starts\n" 869 "*****************************************************************************************");
880 #if defined(PER_BLOCK_CHECKPOINT) 885 if (!
core.
init(vm,
nullptr, get_checkpoints))
887 std::cerr <<
"Failed to initialize core" <<
ENDL;
903 MINFO(
"Dropping hard fork tables...");
919 std::cout <<
std::string(
"Error loading blockchain db: ") + e.
what() +
" -- shutting down now" <<
ENDL;
const char *const ELECTRONEUM_RELEASE_NAME
bool validate_file_checksum_against_dns(std::string import_file_path)
bool deinit()
performs safe shutdown steps for core and core components
bool init(const boost::program_options::variables_map &vm, const test_options *test_options=NULL, const GetCheckpointsCallback &get_checkpoints=nullptr)
initializes the core as needed
void mlog_set_log(const char *log)
#define CATCH_ENTRY(location, return_val)
std::string mlog_get_default_log_path(const char *default_filename)
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size=MAX_LOG_FILE_SIZE, const std::size_t max_log_files=MAX_LOG_FILES)
int pop_blocks(cryptonote::core &core, int num_blocks)
uint64_t num_blocks(const std::vector< test_event_entry > &events)
#define MCLOG_RED(level, cat, x)
std::function< const epee::span< const unsigned char >cryptonote::network_type network)> GetCheckpointsCallback
Callback routine that returns checkpoints data for specific network type.
const command_line::arg_descriptor< bool, false > arg_stagenet_on
void disable_dns_checkpoints(bool disable=true)
set whether or not to enable or disable DNS checkpoints
const arg_descriptor< bool > arg_help
std::string blockchain_db_types(const std::string &sep)
uint64_t get_current_blockchain_height() const
get the current height of the blockchain
virtual void set_batch_transactions(bool)=0
sets whether or not to batch transactions
uint64_t count_blocks(const std::string &dir_path, std::streampos &start_pos, uint64_t &seek_height)
const char *const ELECTRONEUM_VERSION_FULL
bool blockchain_valid_db_type(const std::string &db_type)
const command_line::arg_descriptor< bool, false > arg_testnet_on
bool handle_error_helper(const boost::program_options::options_description &desc, F parser)
std::enable_if<!std::is_same< T, bool >::value, bool >::type has_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg)
boost::program_options::typed_value< T, char > * make_semantic(const arg_descriptor< T, true > &)
const command_line::arg_descriptor< std::string > arg_log_level
handles core cryptonote functionality
unsigned __int64 uint64_t
const command_line::arg_descriptor< std::string, false, true, 2 > arg_data_dir
static void init_options(boost::program_options::options_description &desc)
adds command line options to the given options set
Useful when application has potentially harmful situtaions.
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
const BlockchainDB & get_db() const
get a reference to the BlockchainDB in use by Blockchain
A generic BlockchainDB exception.
Blockchain & get_blockchain_storage()
gets the Blockchain instance
virtual void drop_hard_fork_info()=0
delete hard fork info from database
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
boost::program_options::basic_parsed_options< charT > parse_command_line(int argc, const charT *const argv[], const boost::program_options::options_description &desc, bool allow_unregistered=false)
int import_from_file(cryptonote::core &core, const std::string &import_file_path, uint64_t block_stop=0)
std::string to_string(t_connection_type type)
int parse_db_arguments(const std::string &db_arg_str, std::string &db_type, int &db_flags)
const epee::span< const unsigned char > GetCheckpointsData(cryptonote::network_type network)
const char * what() const
bool is_arg_defaulted(const boost::program_options::variables_map &vm, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg)