diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-26 01:01:58 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2014-09-30 16:21:37 -0400 |
commit | b261d9207ba5cdc0334fab403204971f79b6ca03 (patch) | |
tree | b113fc0deb913b3e27be1d33f60daa62a52462b4 /src/daemon/daemon.cpp | |
parent | reload checkpoints file every ~hr and print if any fail (diff) | |
download | monero-b261d9207ba5cdc0334fab403204971f79b6ca03.tar.xz |
DNS checkpoint updating added, and daemon flag to enforce them
The daemon should now check for updated checkpoints from
checkpoints.moneropulse.org as well as from the configured json file
every ~1hr (and on launch).
The daemon now has a flag to enable enforcing these checkpoints (rather
than just printing a warning when they fail).
TODO: an easily configurable list of DNS servers to check for
checkpoints as opposed to the hard-coded "checkpoints.moneropulse.org"
Diffstat (limited to 'src/daemon/daemon.cpp')
-rw-r--r-- | src/daemon/daemon.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 5e4e9c266..8e915fb1d 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -69,6 +69,7 @@ namespace , "Run on testnet. The wallet must be launched with --testnet flag." , false }; + const command_line::arg_descriptor<bool> arg_dns_checkpoints = {"enforce-dns-checkpointing", "checkpoints from DNS server will be enforced", false}; } bool command_line_preprocessor(const boost::program_options::variables_map& vm) @@ -135,6 +136,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_cmd_sett, arg_log_level); command_line::add_arg(desc_cmd_sett, arg_console); command_line::add_arg(desc_cmd_sett, arg_testnet_on); + command_line::add_arg(desc_cmd_sett, arg_dns_checkpoints); cryptonote::core::init_options(desc_cmd_sett); cryptonote::core_rpc_server::init_options(desc_cmd_sett); @@ -206,17 +208,21 @@ int main(int argc, char* argv[]) CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize checkpoints"); boost::filesystem::path json(JSON_HASH_FILE_NAME); boost::filesystem::path checkpoint_json_hashfile_fullpath = data_dir / json; - res = cryptonote::load_checkpoints_from_json(checkpoints, checkpoint_json_hashfile_fullpath.string().c_str()); - CHECK_AND_ASSERT_MES(res, 1, "Failed to load initial checkpoints"); //create objects and link them cryptonote::core ccore(NULL); + // tell core if we're enforcing dns checkpoints + bool enforce_dns = command_line::get_arg(vm, arg_dns_checkpoints); + ccore.set_enforce_dns_checkpoints(enforce_dns); + if (testnet_mode) { LOG_PRINT_L0("Starting in testnet mode!"); } else { ccore.set_checkpoints(std::move(checkpoints)); ccore.set_checkpoints_file_path(checkpoint_json_hashfile_fullpath.string()); + res = ccore.update_checkpoints(); + CHECK_AND_ASSERT_MES(res, 1, "Failed to load initial checkpoints"); } cryptonote::t_cryptonote_protocol_handler<cryptonote::core> cprotocol(ccore, NULL); |