MCPcopy Create free account
hub / github.com/ElementsProject/elements / initialize_rpc

Function initialize_rpc

src/test/fuzz/rpc.cpp:344–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}; // namespace
343
344void initialize_rpc()
345{
346 rpc_testing_setup = InitializeRPCFuzzTestingSetup();
347 const std::vector<std::string> supported_rpc_commands = rpc_testing_setup->GetRPCCommands();
348 for (const std::string& rpc_command : supported_rpc_commands) {
349 const bool safe_for_fuzzing = std::find(RPC_COMMANDS_SAFE_FOR_FUZZING.begin(), RPC_COMMANDS_SAFE_FOR_FUZZING.end(), rpc_command) != RPC_COMMANDS_SAFE_FOR_FUZZING.end();
350 const bool not_safe_for_fuzzing = std::find(RPC_COMMANDS_NOT_SAFE_FOR_FUZZING.begin(), RPC_COMMANDS_NOT_SAFE_FOR_FUZZING.end(), rpc_command) != RPC_COMMANDS_NOT_SAFE_FOR_FUZZING.end();
351 if (!(safe_for_fuzzing || not_safe_for_fuzzing)) {
352 std::cerr << "Error: RPC command \"" << rpc_command << "\" not found in RPC_COMMANDS_SAFE_FOR_FUZZING or RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
353 std::terminate();
354 }
355 if (safe_for_fuzzing && not_safe_for_fuzzing) {
356 std::cerr << "Error: RPC command \"" << rpc_command << "\" found in *both* RPC_COMMANDS_SAFE_FOR_FUZZING and RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
357 std::terminate();
358 }
359 }
360 const char* limit_to_rpc_command_env = std::getenv("LIMIT_TO_RPC_COMMAND");
361 if (limit_to_rpc_command_env != nullptr) {
362 g_limit_to_rpc_command = std::string{limit_to_rpc_command_env};
363 }
364}
365
366FUZZ_TARGET_INIT(rpc, initialize_rpc)
367{

Callers

nothing calls this directly

Calls 4

GetRPCCommandsMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected