Fix clang-tidy performance-unnecessary-copy-initialization warnings

pull/27605/head
MarcoFalke 2 years ago
parent faaa60a30e
commit fa28850562
No known key found for this signature in database

@ -42,7 +42,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
if (fingerprint.isNull()) {
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
}
const std::string fingerprintStr = fingerprint.get_str();
const std::string& fingerprintStr{fingerprint.get_str()};
// Skip duplicate signer
bool duplicate = false;
for (const ExternalSigner& signer : signers) {

@ -223,8 +223,8 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
{"redeemScript", UniValueType(UniValue::VSTR)},
{"witnessScript", UniValueType(UniValue::VSTR)},
}, true);
UniValue rs = prevOut.find_value("redeemScript");
UniValue ws = prevOut.find_value("witnessScript");
const UniValue& rs{prevOut.find_value("redeemScript")};
const UniValue& ws{prevOut.find_value("witnessScript")};
if (rs.isNull() && ws.isNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript");
}

@ -168,7 +168,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
id = request.find_value("id");
// Parse method
UniValue valMethod = request.find_value("method");
const UniValue& valMethod{request.find_value("method")};
if (valMethod.isNull())
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (!valMethod.isStr())
@ -181,7 +181,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser);
// Parse params
UniValue valParams = request.find_value("params");
const UniValue& valParams{request.find_value("params")};
if (valParams.isArray() || valParams.isObject())
params = valParams;
else if (valParams.isNull())

@ -1133,10 +1133,10 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
if (scanobject.isStr()) {
desc_str = scanobject.get_str();
} else if (scanobject.isObject()) {
UniValue desc_uni = scanobject.find_value("desc");
const UniValue& desc_uni{scanobject.find_value("desc")};
if (desc_uni.isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor needs to be provided in scan object");
desc_str = desc_uni.get_str();
UniValue range_uni = scanobject.find_value("range");
const UniValue& range_uni{scanobject.find_value("range")};
if (!range_uni.isNull()) {
range = ParseDescriptorRange(range_uni);
}

Loading…
Cancel
Save