Skip to content

Commit

Permalink
additional commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kevkevinpal committed Jul 31, 2024
1 parent 52774b1 commit 664dd71
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/test/fuzz/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,22 @@ struct RPCFuzzTestingSetup : public TestingSetup {
return;
}

UniValue result = tableRPC.execute(request);
tableRPC.execute(request);
}

std::vector<std::string> GetRPCCommands() const
{
return tableRPC.listCommands();
}
Span<const CRPCCommand> GetWalletRPCCommands() const
std::vector<std::string> GetWalletRPCCommands() const
{
return wallet::GetWalletRPCCommands();
Span<const CRPCCommand> tableWalletRPC = wallet::GetWalletRPCCommands();
std::vector<std::string> supported_rpc_commands;
for (const auto& c : tableWalletRPC) {
tableRPC.appendCommand(c.name, &c);
supported_rpc_commands.push_back(c.name);
}
return supported_rpc_commands;
}
};

Expand Down Expand Up @@ -194,9 +200,12 @@ const std::vector<std::string> RPC_COMMANDS_SAFE_FOR_FUZZING{
};
// RPC commands which are safe for fuzzing.
const std::vector<std::string> WALLET_RPC_COMMANDS_NOT_SAFE_FOR_FUZZING{
"importwallet",
"loadwallet",
};
// RPC commands which are safe for fuzzing.
const std::vector<std::string> WALLET_RPC_COMMANDS_SAFE_FOR_FUZZING{
"getbalances",
"keypoolrefill",
"newkeypool",
"listaddressgroupings",
Expand Down Expand Up @@ -235,7 +244,6 @@ const std::vector<std::string> WALLET_RPC_COMMANDS_SAFE_FOR_FUZZING{
"getreceivedbylabel",
"gettransaction",
"getunconfirmedbalance",
"getbalances",
"lockunspent",
"listlockunspent",
"listunspent",
Expand Down Expand Up @@ -451,12 +459,7 @@ void FuzzInitRPC()
void FuzzInitWalletRPC()
{
rpc_testing_setup = InitializeRPCFuzzTestingSetup();
Span<const CRPCCommand> tableWalletRPC = rpc_testing_setup->GetWalletRPCCommands();
for (const auto& c : tableWalletRPC) {
tableRPC.appendCommand(c.name, &c);
}
std::vector<std::string> supported_rpc_commands;
supported_rpc_commands.insert(supported_rpc_commands.begin(), tableWalletRPC[0].name);
const std::vector<std::string> supported_rpc_commands = rpc_testing_setup->GetWalletRPCCommands();
initialize(WALLET_RPC_COMMANDS_SAFE_FOR_FUZZING, WALLET_RPC_COMMANDS_NOT_SAFE_FOR_FUZZING, supported_rpc_commands);
}

Expand Down

0 comments on commit 664dd71

Please sign in to comment.