Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: skip bootstrap nodes that are lower than last checkpoint #8519

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/cryptonote_core/blockchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ namespace cryptonote
*/
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
*
Expand Down
4 changes: 4 additions & 0 deletions src/cryptonote_core/cryptonote_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ namespace cryptonote
m_pprotocol = &m_protocol_stub;
}
//-----------------------------------------------------------------------------------
const checkpoints& core::get_checkpoints() const
{
return m_blockchain_storage.get_checkpoints();
}
void core::set_checkpoints(checkpoints&& chk_pts)
{
m_blockchain_storage.set_checkpoints(std::move(chk_pts));
Expand Down
7 changes: 7 additions & 0 deletions src/cryptonote_core/cryptonote_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,13 @@ namespace cryptonote
*/
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
*
Expand Down
6 changes: 6 additions & 0 deletions src/rpc/core_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,12 @@ namespace cryptonote
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())
{
uint64_t top_height = m_core.get_current_blockchain_height();
Expand Down