Merge pull request #8552

93db74a rpc: skip bootstrap nodes that are lower than last checkpoint (selsta)
This commit is contained in:
luigi1111 2022-09-09 12:55:40 -05:00
commit 3178bbe083
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
4 changed files with 24 additions and 0 deletions

View File

@ -158,6 +158,13 @@ namespace cryptonote
*/ */
bool deinit(); bool deinit();
/**
* @brief get a set of blockchain checkpoint hashes
*
* @return set of blockchain checkpoint hashes
*/
const checkpoints& get_checkpoints() const { return m_checkpoints; }
/** /**
* @brief assign a set of blockchain checkpoint hashes * @brief assign a set of blockchain checkpoint hashes
* *

View File

@ -252,6 +252,10 @@ namespace cryptonote
m_pprotocol = &m_protocol_stub; m_pprotocol = &m_protocol_stub;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
const checkpoints& core::get_checkpoints() const
{
return m_blockchain_storage.get_checkpoints();
}
void core::set_checkpoints(checkpoints&& chk_pts) void core::set_checkpoints(checkpoints&& chk_pts)
{ {
m_blockchain_storage.set_checkpoints(std::move(chk_pts)); m_blockchain_storage.set_checkpoints(std::move(chk_pts));

View File

@ -436,6 +436,13 @@ namespace cryptonote
*/ */
void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol); void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol);
/**
* @copydoc Blockchain::get_checkpoints
*
* @note see Blockchain::get_checkpoints()
*/
const checkpoints& get_checkpoints() const;
/** /**
* @copydoc Blockchain::set_checkpoints * @copydoc Blockchain::set_checkpoints
* *

View File

@ -2290,6 +2290,12 @@ namespace cryptonote
return m_bootstrap_daemon->handle_result(false, {}); return m_bootstrap_daemon->handle_result(false, {});
} }
if (bootstrap_daemon_height < m_core.get_checkpoints().get_max_height())
{
MINFO("Bootstrap daemon height is lower than the latest checkpoint");
return m_bootstrap_daemon->handle_result(false, {});
}
if (!m_p2p.get_payload_object().no_sync()) if (!m_p2p.get_payload_object().no_sync())
{ {
uint64_t top_height = m_core.get_current_blockchain_height(); uint64_t top_height = m_core.get_current_blockchain_height();