mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-23 14:10:15 +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);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string&
|
||||
}
|
||||
CKeyID key = GetKeyForDestination(keystore, dest);
|
||||
if (key.IsNull()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("%s does not refer to a key", addr_in));
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' does not refer to a key", addr_in));
|
||||
}
|
||||
CPubKey vchPubKey;
|
||||
if (!keystore.GetPubKey(key, vchPubKey)) {
|
||||
|
||||
Reference in New Issue
Block a user