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 {
41
41
{
42
42
}
43
43
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)
45
45
{
46
46
JSONRPCRequest request;
47
47
request.context = &m_node;
48
48
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);
51
55
}
52
56
53
57
std::vector<std::string> GetRPCCommands () const
@@ -353,7 +357,11 @@ FUZZ_TARGET_INIT(rpc, initialize_rpc)
353
357
}
354
358
try {
355
359
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
+ }
358
366
}
359
367
}
You can’t perform that action at this time.
0 commit comments