mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Replace traditional for with ranged for in primitives
This commit is contained in:
parent
6adc3a3732
commit
72f00608d0
@ -25,9 +25,8 @@ std::string CBlock::ToString() const
|
|||||||
hashMerkleRoot.ToString(),
|
hashMerkleRoot.ToString(),
|
||||||
nTime, nBits, nNonce,
|
nTime, nBits, nNonce,
|
||||||
vtx.size());
|
vtx.size());
|
||||||
for (unsigned int i = 0; i < vtx.size(); i++)
|
for (const auto& tx : vtx) {
|
||||||
{
|
s << " " << tx->ToString() << "\n";
|
||||||
s << " " << vtx[i]->ToString() << "\n";
|
|
||||||
}
|
}
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
|
@ -83,10 +83,9 @@ CTransaction::CTransaction(CMutableTransaction &&tx) : nVersion(tx.nVersion), vi
|
|||||||
CAmount CTransaction::GetValueOut() const
|
CAmount CTransaction::GetValueOut() const
|
||||||
{
|
{
|
||||||
CAmount nValueOut = 0;
|
CAmount nValueOut = 0;
|
||||||
for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); ++it)
|
for (const auto& tx_out : vout) {
|
||||||
{
|
nValueOut += tx_out.nValue;
|
||||||
nValueOut += it->nValue;
|
if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut))
|
||||||
if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut))
|
|
||||||
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
}
|
}
|
||||||
return nValueOut;
|
return nValueOut;
|
||||||
@ -106,11 +105,11 @@ std::string CTransaction::ToString() const
|
|||||||
vin.size(),
|
vin.size(),
|
||||||
vout.size(),
|
vout.size(),
|
||||||
nLockTime);
|
nLockTime);
|
||||||
for (unsigned int i = 0; i < vin.size(); i++)
|
for (const auto& tx_in : vin)
|
||||||
str += " " + vin[i].ToString() + "\n";
|
str += " " + tx_in.ToString() + "\n";
|
||||||
for (unsigned int i = 0; i < vin.size(); i++)
|
for (const auto& tx_in : vin)
|
||||||
str += " " + vin[i].scriptWitness.ToString() + "\n";
|
str += " " + tx_in.scriptWitness.ToString() + "\n";
|
||||||
for (unsigned int i = 0; i < vout.size(); i++)
|
for (const auto& tx_out : vout)
|
||||||
str += " " + vout[i].ToString() + "\n";
|
str += " " + tx_out.ToString() + "\n";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user