aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-09-09 12:55:40 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-09-09 12:55:40 -0500
commit3178bbe083bcb944da602b67e79ee3422accea02 (patch)
tree2986799eb48c438b40a3f7c95fbf323ba26c5950
parentMerge pull request #8548 (diff)
parentrpc: skip bootstrap nodes that are lower than last checkpoint (diff)
downloadmonero-3178bbe083bcb944da602b67e79ee3422accea02.tar.xz
Merge pull request #8552
93db74a rpc: skip bootstrap nodes that are lower than last checkpoint (selsta)
-rw-r--r--src/cryptonote_core/blockchain.h7
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp4
-rw-r--r--src/cryptonote_core/cryptonote_core.h7
-rw-r--r--src/rpc/core_rpc_server.cpp6
4 files changed, 24 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index 7a94f6358..355d0de1a 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -159,6 +159,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
*
* @param chk_pts the set of checkpoints to assign
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 95cd1c83b..31e4e0414 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -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));
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index 5f134a999..6dc513570 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -437,6 +437,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
*
* @note see Blockchain::set_checkpoints()
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 5304333ff..8d13b7634 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -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();