File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,17 @@ struct RPCFuzzTestingSetup : public TestingSetup {
4141 {
4242 }
4343
44- UniValue CallRPC (const std::string& rpc_method, const std::vector<std::string>& arguments)
44+ void CallRPC (const std::string& rpc_method, const std::vector<std::string>& arguments)
4545 {
4646 JSONRPCRequest request;
4747 request.context = &m_node;
4848 request.strMethod = rpc_method;
49- request.params = RPCConvertValues (rpc_method, arguments);
50- return tableRPC.execute (request);
49+ try {
50+ request.params = RPCConvertValues (rpc_method, arguments);
51+ } catch (const std::runtime_error&) {
52+ return ;
53+ }
54+ tableRPC.execute (request);
5155 }
5256
5357 std::vector<std::string> GetRPCCommands () const
@@ -353,7 +357,11 @@ FUZZ_TARGET_INIT(rpc, initialize_rpc)
353357 }
354358 try {
355359 rpc_testing_setup->CallRPC (rpc_command, arguments);
356- } catch (const UniValue&) {
357- } catch (const std::runtime_error&) {
360+ } catch (const UniValue& json_rpc_error) {
361+ const std::string error_msg{find_value (json_rpc_error, " message" ).get_str ()};
362+ if (error_msg.find (" Internal bug detected" ) != std::string::npos) {
363+ // Only allow the intentional internal bug
364+ assert (error_msg.find (" trigger_internal_bug" ) != std::string::npos);
365+ }
358366 }
359367}
You can’t perform that action at this time.
0 commit comments