0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05:00

fuzz: Use C++20 starts_with in rpc.cpp

This commit is contained in:
MarcoFalke 2023-10-03 16:26:30 +02:00
parent faa48388bc
commit fa6e50d6c7
No known key found for this signature in database

View file

@ -380,9 +380,7 @@ FUZZ_TARGET(rpc, .init = initialize_rpc)
rpc_testing_setup->CallRPC(rpc_command, arguments);
} catch (const UniValue& json_rpc_error) {
const std::string error_msg{json_rpc_error.find_value("message").get_str()};
// Once c++20 is allowed, starts_with can be used.
// if (error_msg.starts_with("Internal bug detected")) {
if (0 == error_msg.rfind("Internal bug detected", 0)) {
if (error_msg.starts_with("Internal bug detected")) {
// Only allow the intentional internal bug
assert(error_msg.find("trigger_internal_bug") != std::string::npos);
}