39#undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
40#define ELECTRONEUM_DEFAULT_LOG_CATEGORY "bcutil"
42namespace po = boost::program_options;
45int main(
int argc,
char* argv[])
51 std::string default_db_type =
"lmdb";
54 available_dbs =
"available: " + available_dbs;
58 bool blocks_dat =
false;
62 boost::filesystem::path output_file_path;
64 po::options_description desc_cmd_only(
"Command line options");
65 po::options_description desc_cmd_sett(
"Command line options and settings options");
70 "database", available_dbs.c_str(), default_db_type
86 po::options_description desc_options(
"Allowed options");
87 desc_options.add(desc_cmd_only).add(desc_cmd_sett);
92 po::store(po::parse_command_line(argc, argv, desc_options), vm);
102 std::cout << desc_options << std::endl;
110 mlog_set_log(std::string(std::to_string(log_level) +
",bcutil:INFO").c_str());
117 if (opt_testnet && opt_stagenet)
119 std::cerr <<
"Can't specify more than one of --testnet and --stagenet" << std::endl;
124 std::string m_config_folder;
131 std::cerr <<
"Invalid database type: " << db_type << std::endl;
138 output_file_path = boost::filesystem::path(m_config_folder) /
"export" /
BLOCKCHAIN_RAW;
139 LOG_PRINT_L0(
"Export output file: " << output_file_path.string());
152 LOG_PRINT_L0(
"Initializing source blockchain (BlockchainDB)");
160 LOG_ERROR(
"Attempted to use non-existent database type: " << db_type);
161 throw std::runtime_error(
"Attempting to use non-existent database type");
165 boost::filesystem::path folder(m_config_folder);
167 const std::string filename = folder.string();
169 LOG_PRINT_L0(
"Loading blockchain from folder " << filename <<
" ...");
174 catch (
const std::exception& e)
188 LOG_PRINT_L0(
"Source blockchain storage initialized OK");
199 r =
bootstrap.store_blockchain_raw(core_storage, NULL, output_file_path, block_stop);
bool store_blockchain_raw(cryptonote::Blockchain *cs, cryptonote::tx_memory_pool *txp, boost::filesystem::path &output_file, uint64_t use_block_height=0)
The BlockchainDB backing store interface declaration/contract.
virtual std::string get_db_name() const =0
gets the name of the folder the BlockchainDB's file(s) should be in
virtual void open(const std::string &filename, const int db_flags=0)=0
open a db, or create it if necessary.
bool init(BlockchainDB *db, const network_type nettype=MAINNET, bool offline=false, const cryptonote::test_options *test_options=NULL, difficulty_type fixed_difficulty=0, const GetCheckpointsCallback &get_checkpoints=nullptr, bool ignore_bsig=false, bool fallback_to_pow=false)
Initialize the Blockchain state.
uint32_t get_blockchain_pruning_seed() const
Transaction pool, handles transactions which are not part of a block.
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)
#define CATCH_ENTRY(location, return_val)
std::string mlog_get_default_log_path(const char *default_filename)
void mlog_set_log(const char *log)
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
const arg_descriptor< bool > arg_help
bool is_arg_defaulted(const boost::program_options::variables_map &vm, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg)
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)
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
const command_line::arg_descriptor< std::string, false, true, 2 > arg_data_dir
const command_line::arg_descriptor< bool, false > arg_testnet_on
BlockchainDB * new_db(const std::string &db_type)
bool blockchain_valid_db_type(const std::string &db_type)
const command_line::arg_descriptor< bool, false > arg_stagenet_on
std::string blockchain_db_types(const std::string &sep)
unsigned __int64 uint64_t
const char *const ELECTRONEUM_RELEASE_NAME
const char *const ELECTRONEUM_VERSION_FULL