Daemon should now exit on conflicting checkpoints

If the "enforce DNS checkpoints" flag is not enabled, it should not exit
if DNS checkpoints conflict with the others, but should still print a
warning to the user.
This commit is contained in:
Thomas Winget 2014-09-30 15:24:43 -04:00
parent f0b4138f1f
commit c0bdd511c3
2 changed files with 13 additions and 0 deletions

View file

@ -41,6 +41,7 @@ using namespace epee;
#include "cryptonote_config.h" #include "cryptonote_config.h"
#include "cryptonote_format_utils.h" #include "cryptonote_format_utils.h"
#include "misc_language.h" #include "misc_language.h"
#include <csignal>
DISABLE_VS_WARNINGS(4355) DISABLE_VS_WARNINGS(4355)
@ -98,6 +99,12 @@ namespace cryptonote
res = m_blockchain_storage.update_checkpoints(m_checkpoints_path, false); res = m_blockchain_storage.update_checkpoints(m_checkpoints_path, false);
m_last_json_checkpoints_update = time(NULL); m_last_json_checkpoints_update = time(NULL);
} }
// if anything fishy happened getting new checkpoints, bring down the house
if (!res)
{
graceful_exit();
}
return res; return res;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
@ -583,4 +590,9 @@ namespace cryptonote
uint64_t core::get_target_blockchain_height() const { uint64_t core::get_target_blockchain_height() const {
return m_target_blockchain_height; return m_target_blockchain_height;
} }
//-----------------------------------------------------------------------------------------------
void core::graceful_exit()
{
raise(SIGTERM);
}
} }

View file

@ -145,6 +145,7 @@ namespace cryptonote
bool handle_command_line(const boost::program_options::variables_map& vm, bool testnet); bool handle_command_line(const boost::program_options::variables_map& vm, bool testnet);
bool on_update_blocktemplate_interval(); bool on_update_blocktemplate_interval();
bool check_tx_inputs_keyimages_diff(const transaction& tx); bool check_tx_inputs_keyimages_diff(const transaction& tx);
void graceful_exit();
tx_memory_pool m_mempool; tx_memory_pool m_mempool;