mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 11:09:36 +01:00
rpc: Quote user supplied strings in error messages
This commit is contained in:
@@ -1134,7 +1134,7 @@ CoinStatsHashType ParseHashType(const std::string& hash_type_input)
|
||||
} else if (hash_type_input == "none") {
|
||||
return CoinStatsHashType::NONE;
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s is not a valid hash_type", hash_type_input));
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("'%s' is not a valid hash_type", hash_type_input));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2213,7 +2213,7 @@ static RPCHelpMan getblockstats()
|
||||
for (const std::string& stat : stats) {
|
||||
const UniValue& value = ret_all[stat];
|
||||
if (value.isNull()) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid selected statistic %s", stat));
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid selected statistic '%s'", stat));
|
||||
}
|
||||
ret.pushKV(stat, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user