mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
refactor: Fix remaining clang-tidy performance-unnecessary-copy-initialization errors
This commit is contained in:
parent
2638fdb4f9
commit
3305972f7b
4 changed files with 8 additions and 8 deletions
|
@ -62,7 +62,7 @@ static void SignTransactionSingleInput(benchmark::Bench& bench, InputType input_
|
||||||
bench.minEpochIterations(100).run([&] {
|
bench.minEpochIterations(100).run([&] {
|
||||||
CMutableTransaction tx{unsigned_tx};
|
CMutableTransaction tx{unsigned_tx};
|
||||||
std::map<COutPoint, Coin> coins;
|
std::map<COutPoint, Coin> coins;
|
||||||
CScript prev_spk = prev_spks[(iter++) % prev_spks.size()];
|
const CScript& prev_spk = prev_spks[(iter++) % prev_spks.size()];
|
||||||
coins[prevout] = Coin(CTxOut(10000, prev_spk), /*nHeightIn=*/100, /*fCoinBaseIn=*/false);
|
coins[prevout] = Coin(CTxOut(10000, prev_spk), /*nHeightIn=*/100, /*fCoinBaseIn=*/false);
|
||||||
std::map<int, bilingual_str> input_errors;
|
std::map<int, bilingual_str> input_errors;
|
||||||
bool complete = SignTransaction(tx, &keystore, coins, SIGHASH_ALL, input_errors);
|
bool complete = SignTransaction(tx, &keystore, coins, SIGHASH_ALL, input_errors);
|
||||||
|
|
|
@ -304,7 +304,7 @@ static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strIn
|
||||||
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
||||||
|
|
||||||
// extract and validate ADDRESS
|
// extract and validate ADDRESS
|
||||||
std::string strAddr = vStrInputParts[1];
|
const std::string& strAddr = vStrInputParts[1];
|
||||||
CTxDestination destination = DecodeDestination(strAddr);
|
CTxDestination destination = DecodeDestination(strAddr);
|
||||||
if (!IsValidDestination(destination)) {
|
if (!IsValidDestination(destination)) {
|
||||||
throw std::runtime_error("invalid TX output address");
|
throw std::runtime_error("invalid TX output address");
|
||||||
|
@ -337,7 +337,7 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str
|
||||||
bool bSegWit = false;
|
bool bSegWit = false;
|
||||||
bool bScriptHash = false;
|
bool bScriptHash = false;
|
||||||
if (vStrInputParts.size() == 3) {
|
if (vStrInputParts.size() == 3) {
|
||||||
std::string flags = vStrInputParts[2];
|
const std::string& flags = vStrInputParts[2];
|
||||||
bSegWit = (flags.find('W') != std::string::npos);
|
bSegWit = (flags.find('W') != std::string::npos);
|
||||||
bScriptHash = (flags.find('S') != std::string::npos);
|
bScriptHash = (flags.find('S') != std::string::npos);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& s
|
||||||
bool bSegWit = false;
|
bool bSegWit = false;
|
||||||
bool bScriptHash = false;
|
bool bScriptHash = false;
|
||||||
if (vStrInputParts.size() == numkeys + 4) {
|
if (vStrInputParts.size() == numkeys + 4) {
|
||||||
std::string flags = vStrInputParts.back();
|
const std::string& flags = vStrInputParts.back();
|
||||||
bSegWit = (flags.find('W') != std::string::npos);
|
bSegWit = (flags.find('W') != std::string::npos);
|
||||||
bScriptHash = (flags.find('S') != std::string::npos);
|
bScriptHash = (flags.find('S') != std::string::npos);
|
||||||
}
|
}
|
||||||
|
@ -473,14 +473,14 @@ static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& str
|
||||||
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
||||||
|
|
||||||
// extract and validate script
|
// extract and validate script
|
||||||
std::string strScript = vStrInputParts[1];
|
const std::string& strScript = vStrInputParts[1];
|
||||||
CScript scriptPubKey = ParseScript(strScript);
|
CScript scriptPubKey = ParseScript(strScript);
|
||||||
|
|
||||||
// Extract FLAGS
|
// Extract FLAGS
|
||||||
bool bSegWit = false;
|
bool bSegWit = false;
|
||||||
bool bScriptHash = false;
|
bool bScriptHash = false;
|
||||||
if (vStrInputParts.size() == 3) {
|
if (vStrInputParts.size() == 3) {
|
||||||
std::string flags = vStrInputParts.back();
|
const std::string& flags = vStrInputParts.back();
|
||||||
bSegWit = (flags.find('W') != std::string::npos);
|
bSegWit = (flags.find('W') != std::string::npos);
|
||||||
bScriptHash = (flags.find('S') != std::string::npos);
|
bScriptHash = (flags.find('S') != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ bool BitcoinUnits::parse(Unit unit, const QString& value, CAmount* val_out)
|
||||||
{
|
{
|
||||||
return false; // More than one dot
|
return false; // More than one dot
|
||||||
}
|
}
|
||||||
QString whole = parts[0];
|
const QString& whole = parts[0];
|
||||||
QString decimals;
|
QString decimals;
|
||||||
|
|
||||||
if(parts.size() > 1)
|
if(parts.size() > 1)
|
||||||
|
|
|
@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
|
||||||
bool ignored;
|
bool ignored;
|
||||||
FastRandomContext insecure;
|
FastRandomContext insecure;
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
auto block = blocks[insecure.randrange(blocks.size() - 1)];
|
const auto& block = blocks[insecure.randrange(blocks.size() - 1)];
|
||||||
Assert(m_node.chainman)->ProcessNewBlock(block, true, true, &ignored);
|
Assert(m_node.chainman)->ProcessNewBlock(block, true, true, &ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue