Remove obsolete test-drop-download debug options
What changed, and why it matters
This commit removes two old command-line debug options, --test-drop-download and --test-drop-download-height, that were added in 2015 to help developers manually test network behavior by discarding downloaded blocks. The commit deletes the option definitions, the code that read them, the code that skipped block processing when they were set, and related shell-completion hints. There is no security fix here; it is a cleanup of unused debugging flags.
No security action required. Treat as routine code cleanup. If running custom tests or scripts that relied on --test-drop-download or --test-drop-download-height, update them to no longer use these flags.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the arg_test_drop_download and arg_test_drop_download_height command-line arguments from cryptonote_core, along with core::test_drop_download(), core::test_drop_download_height(), core::get_test_drop_download(), and core::get_test_drop_download_height(). It also removes the conditional early return in cryptonote_protocol_handler.inl that discarded blocks when these flags were active, and updates the unit-test mock core and fish shell completions. The change is purely subtractive and removes functionality rather than fixing a vulnerability.
Changed components
src/cryptonote_core/cryptonote_core.cppsrc/cryptonote_core/cryptonote_core.hsrc/cryptonote_protocol/cryptonote_protocol_handler.inltests/unit_tests/node_server.cpputils/fish/monerod.fishInspect captured patch +0 / −84
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 8580017..400ce96 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -135,16 +135,6 @@ namespace cryptonote
"sync-pruned-blocks"
, "Allow syncing from nodes with only pruned blocks"
};
-
- static const command_line::arg_descriptor<bool> arg_test_drop_download = {
- "test-drop-download"
- , "For net tests: in download, discard ALL blocks instead checking/saving them (very fast)"
- };
- static const command_line::arg_descriptor<uint64_t> arg_test_drop_download_height = {
- "test-drop-download-height"
- , "Like test-drop-download but discards only after around certain height"
- , 0
- };
static const command_line::arg_descriptor<int> arg_test_dbg_lock_sleep = {
"test-dbg-lock-sleep"
, "Sleep time in ms, defaults to 0 (off), used to debug before/after locking mutex. Values 100 to 1000 are good for tests."
@@ -322,9 +312,6 @@ namespace cryptonote
{
command_line::add_arg(desc, arg_data_dir);
- command_line::add_arg(desc, arg_test_drop_download);
- command_line::add_arg(desc, arg_test_drop_download_height);
-
command_line::add_arg(desc, arg_testnet_on);
command_line::add_arg(desc, arg_stagenet_on);
command_line::add_arg(desc, arg_regtest_on);
@@ -392,13 +379,9 @@ namespace cryptonote
set_enforce_dns_checkpoints(command_line::get_arg(vm, arg_dns_checkpoints));
- test_drop_download_height(command_line::get_arg(vm, arg_test_drop_download_height));
m_offline = get_arg(vm, arg_offline);
m_disable_dns_checkpoints = get_arg(vm, arg_disable_dns_checkpoints);
- if (command_line::get_arg(vm, arg_test_drop_download) == true)
- test_drop_download();
-
epee::debug::g_test_dbg_lock_sleep() = command_line::get_arg(vm, arg_test_dbg_lock_sleep);
return true;
@@ -795,32 +778,6 @@ namespace cryptonote
return true;
}
//-----------------------------------------------------------------------------------------------
- void core::test_drop_download()
- {
- m_test_drop_download = false;
- }
- //-----------------------------------------------------------------------------------------------
- void core::test_drop_download_height(uint64_t height)
- {
- m_test_drop_download_height = height;
- }
- //-----------------------------------------------------------------------------------------------
- bool core::get_test_drop_download() const
- {
- return m_test_drop_download;
- }
- //-----------------------------------------------------------------------------------------------
- bool core::get_test_drop_download_height() const
- {
- if (m_test_drop_download_height == 0)
- return true;
-
- if (get_blockchain_storage().get_current_blockchain_height() <= m_test_drop_download_height)
- return true;
-
- return false;
- }
- //-----------------------------------------------------------------------------------------------
bool core::handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, relay_method tx_relay, bool relayed)
{
tvc = {};
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index 2cea119..33e06fd 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -316,35 +316,6 @@ namespace cryptonote
*/
bool deinit();
- /**
- * @brief sets to drop blocks downloaded (for testing)
- */
- void test_drop_download();
-
- /**
- * @brief sets to drop blocks downloaded below a certain height
- *
- * @param height height below which to drop blocks
- */
- void test_drop_download_height(uint64_t height);
-
- /**
- * @brief gets whether or not to drop blocks (for testing)
- *
- * @return whether or not to drop blocks
- */
- bool get_test_drop_download() const;
-
- /**
- * @brief gets whether or not to drop blocks
- *
- * If the current blockchain height <= our block drop threshold
- * and test drop blocks is set, return true
- *
- * @return see above
- */
- bool get_test_drop_download_height() const;
-
/**
* @copydoc Blockchain::get_current_blockchain_height
*
@@ -1069,10 +1040,6 @@ namespace cryptonote
*/
bool recalculate_difficulties();
- bool m_test_drop_download = true; //!< whether or not to drop incoming blocks (for testing)
-
- uint64_t m_test_drop_download_height = 0; //!< height under which to drop incoming blocks, if doing so
-
BlockchainAndPool m_bap; //! Contains owned instances of Blockchain and tx_memory_pool
tx_memory_pool& m_mempool; //!< ref to transaction pool instance in m_bap
Blockchain& m_blockchain_storage; //!< ref to Blockchain instance in m_bap
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index a115d50..b7fcf4f 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -1281,10 +1281,6 @@ namespace cryptonote
const crypto::hash last_block_hash = cryptonote::get_block_hash(b);
context.m_last_known_hash = last_block_hash;
-
- if (!m_core.get_test_drop_download() || !m_core.get_test_drop_download_height()) { // DISCARD BLOCKS for testing
- return 1;
- }
}
try_add_next_blocks(context);
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp
index 3372206..00a9f07 100644
--- a/tests/unit_tests/node_server.cpp
+++ b/tests/unit_tests/node_server.cpp
@@ -86,8 +86,6 @@ public:
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, bool clip_pruned, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;}
bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;}
cryptonote::blockchain_storage &get_blockchain_storage() { throw std::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class test_core."); }
- bool get_test_drop_download() const {return true;}
- bool get_test_drop_download_height() const {return true;}
bool prepare_handle_incoming_blocks(const std::vector<cryptonote::block_complete_entry> &blocks_entry, std::vector<cryptonote::block> &blocks) { return true; }
bool cleanup_handle_incoming_blocks(bool force_sync = false) { return true; }
bool check_incoming_block_size(const cryptonote::blobdata& block_blob) const { return true; }
diff --git a/utils/fish/monerod.fish b/utils/fish/monerod.fish
index 2800bf1..16ee0ff 100644
--- a/utils/fish/monerod.fish
+++ b/utils/fish/monerod.fish
@@ -19,8 +19,6 @@ complete -c monerod -l zmq-rpc-bind-port -r -d "Port for ZMQ RPC server to liste
complete -c monerod -l zmq-pub -r -d "Address for ZMQ pub - tcp://ip:port or ipc://path "
complete -c monerod -l no-zmq -d "Disable ZMQ RPC server [114/349]"
complete -c monerod -l data-dir -x -a "(__fish_complete_directories)" -d "Specify data directory"
-complete -c monerod -l test-drop-download -d "For net tests: in download, discard ALL blocks instead checking/saving them (very fast)"
-complete -c monerod -l test-drop-download-height -r -d "Like test-drop-download but discards only after around certain height. Default: 0"
complete -c monerod -l testnet -d "Run on testnet. The wallet must be launched with --testnet flag."
complete -c monerod -l stagenet -d "Run on stagenet. The wallet must be launched with --stagenet flag."
complete -c monerod -l regtest -d "Run in a regression testing mode."
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.