diff options
| author | rfree2monero <rfreemonero@op.pl> | 2015-04-01 18:24:45 +0200 |
|---|---|---|
| committer | rfree2monero <rfreemonero@op.pl> | 2015-04-01 18:24:45 +0200 |
| commit | 3cbdf198f168e113f12fa49d016133c434964ed7 (patch) | |
| tree | 050c74077de8e1b6e431f7d0671b57b5afcb01ab /src/cryptonote_core/cryptonote_core.cpp | |
| parent | f79821ac7ebc269b18dd2edd8ac0cb022861ad11 (diff) | |
| parent | b0151de60144ddc1f56d253e7574bd6a9aefa28f (diff) | |
| download | monzero-core-3cbdf198f168e113f12fa49d016133c434964ed7.tar.gz monzero-core-3cbdf198f168e113f12fa49d016133c434964ed7.tar.xz monzero-core-3cbdf198f168e113f12fa49d016133c434964ed7.zip | |
Merge remote-tracking branch 'monero-official/master' into network-1.6-work1
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 49ce63065..505feb563 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -42,6 +42,8 @@ using namespace epee; #include "cryptonote_format_utils.h" #include "misc_language.h" #include <csignal> +#include "daemon/command_line_args.h" +#include "cryptonote_core/checkpoints_create.h" DISABLE_VS_WARNINGS(4355) @@ -108,14 +110,41 @@ namespace cryptonote return res; } //----------------------------------------------------------------------------------- + void core::stop() + { + graceful_exit(); + } + //----------------------------------------------------------------------------------- void core::init_options(boost::program_options::options_description& /*desc*/) { } //----------------------------------------------------------------------------------------------- - bool core::handle_command_line(const boost::program_options::variables_map& vm, bool testnet) + bool core::handle_command_line(const boost::program_options::variables_map& vm) { - auto data_dir_arg = testnet ? command_line::arg_testnet_data_dir : command_line::arg_data_dir; + m_testnet = command_line::get_arg(vm, daemon_args::arg_testnet_on); + + auto data_dir_arg = m_testnet ? command_line::arg_testnet_data_dir : command_line::arg_data_dir; m_config_folder = command_line::get_arg(vm, data_dir_arg); + + auto data_dir = boost::filesystem::path(m_config_folder); + + if (!m_testnet) + { + cryptonote::checkpoints checkpoints; + if (!cryptonote::create_checkpoints(checkpoints)) + { + throw std::runtime_error("Failed to initialize checkpoints"); + } + set_checkpoints(std::move(checkpoints)); + + boost::filesystem::path json(JSON_HASH_FILE_NAME); + boost::filesystem::path checkpoint_json_hashfile_fullpath = data_dir / json; + + set_checkpoints_file_path(checkpoint_json_hashfile_fullpath.string()); + } + + + set_enforce_dns_checkpoints(command_line::get_arg(vm, daemon_args::arg_dns_checkpoints)); return true; } //----------------------------------------------------------------------------------------------- @@ -154,21 +183,21 @@ namespace cryptonote return m_blockchain_storage.get_alternative_blocks_count(); } //----------------------------------------------------------------------------------------------- - bool core::init(const boost::program_options::variables_map& vm, bool testnet) + bool core::init(const boost::program_options::variables_map& vm) { - bool r = handle_command_line(vm, testnet); + bool r = handle_command_line(vm); r = m_mempool.init(m_config_folder); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize memory pool"); - r = m_blockchain_storage.init(m_config_folder, testnet); + r = m_blockchain_storage.init(m_config_folder, m_testnet); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage"); // load json & DNS checkpoints, and verify them // with respect to what blocks we already have CHECK_AND_ASSERT_MES(update_checkpoints(), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints."); - r = m_miner.init(vm, testnet); + r = m_miner.init(vm, m_testnet); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage"); return load_state_data(); |
