Skip to content

Commit 5252f86

Browse files
fuzz: Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of #ifdef forests
1 parent 54549dd commit 5252f86

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

src/test/fuzz/rpc.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,13 @@ const std::vector<std::string> RPC_COMMANDS_NOT_SAFE_FOR_FUZZING{
6868
"addpeeraddress", // avoid DNS lookups
6969
"analyzepsbt", // avoid signed integer overflow in CFeeRate::GetFee(unsigned long) (https://github.com/bitcoin/bitcoin/issues/20607)
7070
"dumptxoutset", // avoid writing to disk
71-
#ifdef ENABLE_WALLET
7271
"dumpwallet", // avoid writing to disk
73-
#endif
7472
"echoipc", // avoid assertion failure (Assertion `"EnsureAnyNodeContext(request.context).init" && check' failed.)
7573
"generatetoaddress", // avoid prohibitively slow execution (when `num_blocks` is large)
7674
"generatetodescriptor", // avoid prohibitively slow execution (when `nblocks` is large)
7775
"gettxoutproof", // avoid prohibitively slow execution
78-
#ifdef ENABLE_WALLET
7976
"importwallet", // avoid reading from disk
8077
"loadwallet", // avoid reading from disk
81-
#endif
8278
"prioritisetransaction", // avoid signed integer overflow in CTxMemPool::PrioritiseTransaction(uint256 const&, long const&) (https://github.com/bitcoin/bitcoin/issues/20626)
8379
"savemempool", // disabled as a precautionary measure: may take a file path argument in the future
8480
"setban", // avoid DNS lookups
@@ -332,20 +328,6 @@ void initialize_rpc()
332328
std::terminate();
333329
}
334330
}
335-
for (const std::string& rpc_command : RPC_COMMANDS_SAFE_FOR_FUZZING) {
336-
const bool supported_rpc_command = std::find(supported_rpc_commands.begin(), supported_rpc_commands.end(), rpc_command) != supported_rpc_commands.end();
337-
if (!supported_rpc_command) {
338-
std::cerr << "Error: Unknown RPC command \"" << rpc_command << "\" found in RPC_COMMANDS_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
339-
std::terminate();
340-
}
341-
}
342-
for (const std::string& rpc_command : RPC_COMMANDS_NOT_SAFE_FOR_FUZZING) {
343-
const bool supported_rpc_command = std::find(supported_rpc_commands.begin(), supported_rpc_commands.end(), rpc_command) != supported_rpc_commands.end();
344-
if (!supported_rpc_command) {
345-
std::cerr << "Error: Unknown RPC command \"" << rpc_command << "\" found in RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
346-
std::terminate();
347-
}
348-
}
349331
const char* limit_to_rpc_command_env = std::getenv("LIMIT_TO_RPC_COMMAND");
350332
if (limit_to_rpc_command_env != nullptr) {
351333
g_limit_to_rpc_command = std::string{limit_to_rpc_command_env};

0 commit comments

Comments
 (0)