mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 14:53:27 +01:00
core: moan when we think an update is needed to get latest hard fork info
This commit is contained in:
parent
f85498422d
commit
8ffc508cef
@ -3074,3 +3074,8 @@ void Blockchain::set_user_options(uint64_t maxthreads, uint64_t blocks_per_sync,
|
|||||||
m_db_blocks_per_sync = blocks_per_sync;
|
m_db_blocks_per_sync = blocks_per_sync;
|
||||||
m_max_prepare_blocks_threads = maxthreads;
|
m_max_prepare_blocks_threads = maxthreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HardFork::State Blockchain::get_hard_fork_state() const
|
||||||
|
{
|
||||||
|
return m_hardfork.get_state();
|
||||||
|
}
|
||||||
|
@ -159,6 +159,8 @@ namespace cryptonote
|
|||||||
|
|
||||||
void set_show_time_stats(bool stats) { m_show_time_stats = stats; }
|
void set_show_time_stats(bool stats) { m_show_time_stats = stats; }
|
||||||
|
|
||||||
|
HardFork::State get_hard_fork_state() const;
|
||||||
|
|
||||||
BlockchainDB& get_db()
|
BlockchainDB& get_db()
|
||||||
{
|
{
|
||||||
return *m_db;
|
return *m_db;
|
||||||
|
@ -830,11 +830,37 @@ namespace cryptonote
|
|||||||
#else
|
#else
|
||||||
m_store_blockchain_interval.do_call(boost::bind(&blockchain_storage::store_blockchain, &m_blockchain_storage));
|
m_store_blockchain_interval.do_call(boost::bind(&blockchain_storage::store_blockchain, &m_blockchain_storage));
|
||||||
#endif
|
#endif
|
||||||
|
m_fork_moaner.do_call(boost::bind(&core::check_fork_time, this));
|
||||||
m_miner.on_idle();
|
m_miner.on_idle();
|
||||||
m_mempool.on_idle();
|
m_mempool.on_idle();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
bool core::check_fork_time()
|
||||||
|
{
|
||||||
|
#if BLOCKCHAIN_DB == DB_LMDB
|
||||||
|
HardFork::State state = m_blockchain_storage.get_hard_fork_state();
|
||||||
|
switch (state) {
|
||||||
|
case HardFork::LikelyForked:
|
||||||
|
LOG_PRINT_L0(ENDL
|
||||||
|
<< "**********************************************************************" << ENDL
|
||||||
|
<< "Last scheduled hard fork is too far in the past." << ENDL
|
||||||
|
<< "We are most likely forked from the network. Daemon update needed now." << ENDL
|
||||||
|
<< "**********************************************************************" << ENDL);
|
||||||
|
break;
|
||||||
|
case HardFork::UpdateNeeded:
|
||||||
|
LOG_PRINT_L0(ENDL
|
||||||
|
<< "**********************************************************************" << ENDL
|
||||||
|
<< "Last scheduled hard fork time shows a daemon update is needed now." << ENDL
|
||||||
|
<< "**********************************************************************" << ENDL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
void core::set_target_blockchain_height(uint64_t target_blockchain_height)
|
void core::set_target_blockchain_height(uint64_t target_blockchain_height)
|
||||||
{
|
{
|
||||||
m_target_blockchain_height = target_blockchain_height;
|
m_target_blockchain_height = target_blockchain_height;
|
||||||
|
@ -167,6 +167,7 @@ namespace cryptonote
|
|||||||
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();
|
void graceful_exit();
|
||||||
|
bool check_fork_time();
|
||||||
static std::atomic<bool> m_fast_exit;
|
static std::atomic<bool> m_fast_exit;
|
||||||
bool m_test_drop_download = true;
|
bool m_test_drop_download = true;
|
||||||
uint64_t m_test_drop_download_height = 0;
|
uint64_t m_test_drop_download_height = 0;
|
||||||
@ -185,6 +186,7 @@ namespace cryptonote
|
|||||||
std::string m_config_folder;
|
std::string m_config_folder;
|
||||||
cryptonote_protocol_stub m_protocol_stub;
|
cryptonote_protocol_stub m_protocol_stub;
|
||||||
epee::math_helper::once_a_time_seconds<60*60*12, false> m_store_blockchain_interval;
|
epee::math_helper::once_a_time_seconds<60*60*12, false> m_store_blockchain_interval;
|
||||||
|
epee::math_helper::once_a_time_seconds<60*60*2, false> m_fork_moaner;
|
||||||
friend class tx_validate_inputs;
|
friend class tx_validate_inputs;
|
||||||
std::atomic<bool> m_starter_message_showed;
|
std::atomic<bool> m_starter_message_showed;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user